F
frank.meulblok
Guest
If the XML structure allows reading into a dataset/temp-table via READ-XML, you could then use WRITE-JSON to write it out again. Otherwise, use the SAX-READER to parse the XML, and from it's callbacks use the Progress.Json.* classes to build the JSON string. As first, generic approach you'll probably want map each XML element to a new JSON object, and add XML attributes as attributes of that JSON object. Map XML sub-elements to a JSON array of JSON objects. If you know what JSON layout you want to use for a given XML document type, change that approach as desired. (You could also use the X-DOCUMENT DOM tree, but well, for this purpose the SAX approach tends to be more elegant and lightweight.)
Continue reading...
Continue reading...