Does anybody know a quick way to convert a SimpleXMLElement to a normal STDClass object, without iterating through each branch manually? I would feel better working with a normal object after fetching the data.
+2
A:
I don't know if there's a way to convert the object without iterating through it. My guess is that you can't.
You can check this thread out, it shows you how to convert a SimpleXML to an array, you can adapt that.
Alex Ciminian
2009-10-18 12:13:44
+2
A:
I suggest looking into using XMLReader, which lends itself well to extracting data and storing it as whatever data type one wishes, instead of SimpleXML. It's especially good for regularly-used documents (I use it, extended as RSSReader, for RSS), is much faster than might be expected, and as a bonus uses less memory than SimpleXML.
GZipp
2009-10-18 16:47:37
Thanks GZipp, I will look into that.
Pekka
2009-10-18 23:32:44