Hi,
I want to append one xml tag to an existing xml file. That's it.
I want to use XML DOM to acomplish this but i am not sure if this is that simple.
I need to load the xml file, place one new tag at the beggining and then save(xml_file) without the need to read each tag and write it out. I am not much familour with xml dom, but i coudn't find an example like this.
Can I do that?
thanks.
xml dom and php
Moderator: General Moderators
Re: xml dom and php
Start with http://www.php.net/manual/en/book.dom.php
There are 10 types of people in this world, those who understand binary and those who don't
Re: xml dom and php
thanks, I already looked into that, tried something withVladSun wrote:Start with http://www.php.net/manual/en/book.dom.php
DOMDocumentFragment::appendXML — Append raw XML data
and i have the new tag at the end of the xml file. At least is something. Now I am trying to move it to be the first tag, not the last.
Re: xml dom and php
Probably, you will need to use DOMDocument::createElement and DOMNode, DOMXPath functions.
There are 10 types of people in this world, those who understand binary and those who don't
Re: xml dom and php
thanks for pointing that out, it helped. I did what I wanted, put a new tag at the begging of a big xml file.VladSun wrote:Probably, you will need to use DOMDocument::createElement and DOMNode, DOMXPath functions.
thank you.