Thanks to both online and offline suggestions, I’ve updated the specs with the following changes (and tested my toolkit) Lower case elements Cleaned up the XSD a bit to use direct types instead of trivial restrictions. Made null an actual empty element Still thinking about the string escaping issue. I was unaware that JSON allowed NUL values in strings, I need to ponder that. ( as well as other Unicode values unallowed in XML even as entities). This is a minor piece of the framework of a much more comprehensive JSON/XML transformation project I’m working on, so should not be confused with arbitrary XML<->JSON bidirectional transformations. That’s another beast entirely which I’m trying to tame. Thank you all for the feedback ! From: Michael Kay [mailto:mike@saxonica.com]
I’ve had this working for a while but finally got around to publishing the specs. http://xml.calldei.com/JsonXML This is currently implemented in the xml2json and json2xml commands in xmlsh (http://www.xmlsh.org) The goal of this schema is a direct mapping in XML to the JSON data model, NOT a “nice XML transformation of JSON”. ( I’m working on that separately which I hope to publish later this year). This is extremely simple (intentionally) and should be easy to implemented in most languages. ---------------------------------------- David A. Lee
|