SimpleXMLElement to modify root tag

Ornamy

New Member
Good day,I am having trouble modifying XML using SimpleXMLElement in PHP.My XML structure is as below:\[code\]<chart caption='NULL' shownames='1' showvalues='0' decimals='2' numberPrefix='$' useRoundEdges='0' legendBorderAlpha='0' bgColor='FFFFFF' canvasBorderColor='A5A5A5' canvasBorderThickness='1' showToolTip='1'>...</chart>\[/code\]How can I modify the attributes() on the root tag using SimpleXMLElement?Thank you!EDIT:Hmm... I found a way but I dont believe its very clean. I added a \[code\]<root><chart ...>...</chart></root>\[/code\] tag wraping my XML data. And I finally added \[code\]str_replace(array("<root>", "</root>"), "", $_RenderedXML->asXML())\[/code\] to my code. Any idea that is.. "cleaner"?
 
Back
Top