0

Well, i have this thing, i need to edit a XML file that is pre-formated, only need to change some variables:

This is the XML i have by defauld and i need to edit some "fields":

        <clstamp>TS11030954594,1410000-1</clstamp>
    <nome>**Carlos Raul**</nome>
    <no>764</no>
    <estab>0</estab>
    <vendnm/>
    <ncont>**236730339**</ncont>
    <nome2/>
    <saldo>.00000</saldo>
    <esaldo>.000000</esaldo>
    <moeda>EURO</moeda>
    <fax/>
    <telefone>**969273816**</telefone>
    <contacto/>
    <acmfact>14041.75928</acmfact>
    <eacmfact>70.040000</eacmfact>
    <rentval>.00000</rentval>
    <erentval>.000000</erentval>
    <eem>false</eem>
    <emno>0</emno>
    <eag>false</eag>
    <agno>0</agno>
    <eid>false</eid>
    <idno>0</idno>
    <efl>false</efl>
    <flno>0</flno>
    <flestab>0</flestab>
    <morada>**Rua Cidade Rio Maior Lote 244**</morada>
    <local>**Odivelas**</local>
    <codpost>**1675-674 Famões**</codpost>

The data in bold would be introduced using a form, i thought of doing something like this:

    <clstamp>TS11030954594,1410000-1</clstamp>
    <nome>**.$name**</nome>
    <no>764</no>
    <estab>0</estab>
    <vendnm/>
    <ncont>**.$Telefone**</ncont>
    <nome2/>
    <saldo>.00000</saldo>
    <esaldo>.000000</esaldo>
    <moeda>EURO</moeda>
    <fax/>
    <telefone>.$Cellphone</telefone>
    <contacto/>
    <acmfact>14041.75928</acmfact>
    <eacmfact>70.040000</eacmfact>
    <rentval>.00000</rentval>
    <erentval>.000000</erentval>
    <eem>false</eem>
    <emno>0</emno>
    <eag>false</eag>
    <agno>0</agno>
    <eid>false</eid>
    <idno>0</idno>
    <efl>false</efl>
    <flno>0</flno>
    <flestab>0</flestab>
    <morada>**.$Adress**</morada>
    <local>**.$City**</local>
    <codpost>**.$Postcode**</codpost>

I could make the output a simple plain html and than export the file changing manualy the mime-type to *.XML

I've heard about xwdt or something, but haven't investigated this. Do you people have some sugestions to give me?

Thanks very much guys!

1 Answer 1

1

Do you need to write the XML out to a file on the web server? If so, you dont need to worry about mime types, just output the XML direct to a file as a text string.

here is a good tutorial on how to write to a file: http://www.tizag.com/phpT/filewrite.php

The code you listed in the second example will be fine, just save it into a variable then write it out using fwrite.

Sign up to request clarification or add additional context in comments.

3 Comments

Well, i gess i will do what i tought of from the beggining and use your hint to help me write the file. I managed to do almost everything exept i'm having problems with the xml inside a variable :/
Souza - what problems are you having?
Gavin Coates, i couldn't manage to inser all (A lot) the xml inside a variable, instead, i used the file_get_contents and it's now working like a charm ;) . Thank you for your help Gavin. Regards.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.