write xml to specified node
Posted: Thu Jun 10, 2010 12:00 am
Hey,
So I am currently working on CMS that will automate the process of creating an XML file with data from form inputs. I know how to read and write XML using SimpleXML and the DOM.
My question is...how do you write children to a specified node in a document? If possible, I'd prefer to do it with SimpleXML. For example I something like this:
What I want to do is be able to append children to the screen node where the id="02". In addition, I will have to be able to append children to any number of screen nodes. There is not a set number of screen nodes per file. Any help would be awesome!
So I am currently working on CMS that will automate the process of creating an XML file with data from form inputs. I know how to read and write XML using SimpleXML and the DOM.
My question is...how do you write children to a specified node in a document? If possible, I'd prefer to do it with SimpleXML. For example I something like this:
Code: Select all
<?xml version="1.0"?>
<shell>
<chapter id="01">
<screen id="01">
<background>...</background>
</screen>
<screen id="02" />
</chapter>
</shell>