[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] The perils of using the @ symbol in JSON key name ... mapping JSON toXML
Hi Folks, In XML documents an element name cannot begin with the @ symbol; this is illegal: <@foo /> Likewise an attribute name cannot begin with an @ symbol; this is illegal: <Document @id="..." /> Schematron, XPath, and XQuery uses the @ symbol to denote "attribute"; for example: Book/@id JSON places no restrictions on the symbols used in JSON object keys; in particular, a key name may start with the @ symbol. For example, this is perfectly legal: { "@bar": "..." } At the present time in history XML has a much richer suite of tools than JSON. For example, there is nothing in the JSON tool suite that can match the ability of Schematron to declaratively express codependency rules; there is nothing in the JSON tool suite analogous to XSLT, XPath, or XQuery. So I would imagine that at least for the foreseeable future people will convert JSON to XML, Schematron, XSLT, XPath, and/or XQuery to leverage the rich XML tool suite. In light of this it seems reasonable to me that when designing JSON documents it would be well-advised to heed some of the XML naming requirements such as, "a name must not begin with an @ symbol". Question: would you please provide a concrete example to illustrate a problem with converting JSON to XML, Schematron, XSLT, XPath, and/or XQuery when the JSON contains key names that start with an @ symbol? /Roger
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|