say I have XML:
<root> <nodeA /> <nodeA /> <nodeA /> <nodeC /> <nodeC /> <nodeC /> </root>
How do I insert "nodeB" between As and Cs? In PHP, preferably via SimpleXML? Like:
<root> <nodeA /> <nodeA /> <nodeA /> <nodeB /> <nodeC /> <nodeC /> <nodeC /> </root>
The following is a function to insert a new SimpleXMLElement after some other SimpleXMLElement. Since this isn't directly possible with SimpleXML, it uses some DOM classes/methods behind-the-scenes to get the job done.
And an example of how it might be used (specific to your question):
If you want/need an explanation of how this works (the code is fairly simple but might include foreign concepts), just ask.