json_decode/encode on simplexmlelement adds arrays instead of empty strings

sanjaydutta

New Member
when loading an xml document and converting to an array using\[code\]json_decode(json_encode(simplexml_load_string($xml)), 1);\[/code\]All empty xml nodes (\[code\]<node />\[/code\]) are converted to array() I would like them to be an empty string instead. Do I need to go through all elements and replace each empty node with something else?I am loading the xml document with \[code\]$xml = new SimpleXmlElement($this->feed_uri, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG , true);\[/code\]Is there a better way of doing this?
 
Back
Top