0

Possible Duplicate:
SimpleXML how to prepend a child in a node?

My XML file is like this:

<?xml version="1.0"?>
<tt xmlns="http://www.w3.org/2006/10/ttaf1">
  <body>
    <div>
    <p begin="00:00:12" end="00:00:13"></p>
    </div>
  </body>
</tt>

Now I want to add the following to the this file:

<p begin="00:00:25" end="00:00:25"></p>

I want to add this in the division element block. Can somebody give me a sample code to do this?

Community
  • 1
  • 1
Poojan
  • 3,312
  • 4
  • 20
  • 23
  • Do you mean PHP's simpleXML or something else? – yankee Jun 28 '11 at 07:50
  • yes i want to edit it using PHP's simpleXML. Actually I want to add captions to the video and so i want to edit DFXP caption file using PHP – Poojan Jun 28 '11 at 07:52
  • This is not quite the right place to ask for others to do everything. Please read the manual that contains examples on how to work with SimpleXML: http://de2.php.net/manual/en/simplexml.examples-basic.php If you then still have problems, describe your problem here again more specifically. – yankee Jun 28 '11 at 08:17
  • Imho SimpleXML is 'harder' than DOMDocument. With DOMDocument you can use DOMDocumentFragment::appendXML: http://php.net/domdocumentfragment.appendxml – Saxoier Jun 28 '11 at 09:36

0 Answers0