-2

Possible Duplicate:
PHP: Create new XML file and write data to it?
PHP DOM method createElement need to be self-closing tag

i am trying to create a XML file with php, but i don`t know a commmand which creates the following:

<gexf xmlns="http://www.gexf.net/1.2draft" version="1.2">
    <graph mode="static" defaultedgetype="directed">
        <nodes>
            <node id="0" label="Hello" />  //I mena this Object
            <node id="1" label="Word" />
        </nodes>
        <edges>
            <edge id="0" source="0" target="1" />
        </edges>
    </graph>
</gexf>

I'm talking about this child that doesn't consist of one opening statement and a close statement but just a single statement. Now I'm looking for a command that can create this kind of child (<node/>)

Community
  • 1
  • 1
Tim
  • 113
  • 10

1 Answers1

0

You have two choices.

1 - XML is just a text file. Just create a text file using fopen etc.

Or

2 - Use the DOMDocument model to create the tree structure. You can then use this to create the file from that using the saveXML function.

It is entirely up to you.

Ed Heal
  • 59,252
  • 17
  • 87
  • 127
  • Hello, i dont have a generall problem with creating xml files, i want to produce the element i have marked in the source code with //I mean this object, but i don`t even know which name it has so i can`t google it. – Tim Jan 02 '13 at 15:42