Util class for parsing XML documents to object-based representations (using
Maps and Lists) and for serialization to JSON strings.
The simple XML-object representation adheres to the following rules:
- element nodes on the same level end-up in a hash
- all element nodes are represented as arrays
- element nodes with the same name on a given level end up in the same array
- sub-elements are keyed using their names
- attributes are member strings with keys preceded with an '@'
- text nodes are concat and put in a memeber called '#text' unless a node
has no children in which case text is a direct member
- text nodes are concat and put in a memeber called '#text' unless node
Eg:
Successresponse OK;
ends up as:
"{\"diag\":[{\"@code\":\"200\",\"#text\":\"response OK\"}],\"status\":[\"Success\"]}";
JSON sepresentation follows the object layout directly.