Ask a Question
Advertise on boostr.in
in simplexml how can i add an existing simplexmlelement as a child element using -'php,oop,simplexml'
in simplexml how can i add an existing simplexmlelement as a child element ¬†using -'php,oop,simplexml'
I have a SimpleXMLElement object $child, and a SimpleXMLElement object $parent.
How can I add $child as a child of $parent? ¬†Is there any way of doing this without converting to DOM and back?
The addChild() method only seems to allow me to create a new, empty element, but that doesn't help when the element I want to add $child also has children. ¬†I'm thinking I might need recursion here.
Sep 7, 2015
to add a comment.
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please