Stas: In Example 1, note that the value of the "b" element, "bar", is not in the JSON representation. In Example2, the attribute "id" found in element "b" is not represented in the JSON.

I'm not entirely sure how you represent an XML element that has both attributes and values, but surely we need to be able to do so.

Posted by Chris Edwards (spcmky) on 2009-10-14T09:15:44.000+0000

One example would be to create a special array index called "name" or"value" or etc. that would contain the element's info. This way it can coexist with the attributes index. This changes the data structure though but it's a special case and would need to be handled when converting back to xml.

Posted by Enrico Zimuel (zimuel) on 2011-04-29T07:34:44.000+0000

My suggestion is to store the text value of a XML element using the key "@text" in the JSON format.
The idea is to use the same logic of the @attributes JSON element.
For instance, the following XML:
bar
can be represented in this JSON structure:
{"a":{"b":{"@attributes":{"id":"foo"}},"@text":"bar"}}
This should be the behaviour only in presence of "complex" XML elements (that means elements with attributes or sub-elements).
For instance the following simple XML:
foo
will continue to be represented with the JSON string: {"a":"foo"}, instead of {"a":{"@text":"foo"}}

Posted by Enrico Zimuel (zimuel) on 2011-05-03T16:35:23.000+0000

Resolved in branches/release-1.11 (commit 23971 and 23973)

Posted by Simon Stücher (billomat) on 2011-05-16T15:26:20.000+0000

With your changes in rev23915 $recursionDepth from _processXml is not recursion depth but the number of root-child-elements!
Therefore you are not able to process a xml with more than 25 elements!
The old one hat a additional $recursionDepth--; in line 331 which is missing in revision 23915

Posted by Enrico Zimuel (zimuel) on 2011-05-16T16:42:18.000+0000

Simon thanks for the feedback. I used a $recursionDepth++ instead of $recursionDepth+1 in the recursive call (line 280).
Resolved in trunk (commit 24039). Please test it and let me know, thanks.

Posted by Simon Stücher (billomat) on 2011-05-17T08:08:58.000+0000

Thanks for the very quick response and bugfix, Enrico! Now it works as expected.