OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] #Announce published JXML schema, an XML schema forrepresenting the JSON data model

Michael Kay scripsit:

> It seems rather odd that BOOLEAN should be an enumerated string rather  
> than an xs:boolean.

xs:boolean is a rather irritating type, a relic of the SGML days when
the cost of a document was measured in keystrokes, making "true" four
times more expensive than "1" and "false" five times more than "0".
I suppose an appropriate restriction of xs:boolean (is that even
possible?)  would be better.

> You need to say whether strings are held in JSON format (with  
> backslashes) or are unescaped. You're damned if you do, damned if you  
> don't: if you try to do unescaping then you hit the nastiness that JSON  
> can contain \0 which can't be represented directly in XML.

I think the best approach is to directly represent every character
except #x0-#x8, #xB-#x1F, \, #xFFFE, and #xFFFF, and escape them with
JSON escaping.

A disputed case is escaped unpaired surrogates in JSON strings: is
"a\ud800b" is a valid JSON string?  Crockford says it's valid, following
the model of JavaScript strings, which are really sequences of arbitrary
integers between 0 and 65535.  I say that RFC 4627 rules them out, saying
"A string is a sequence of zero or more Unicode characters", even if
Crockford did not intend that interpretation when he wrote the RFC.

> We're working on parse-json() and serialize-json() for XSLT 3.0 right  
> now. At present we're converting to new map/array data structures rather  
> than XML trees, but this could well be an alternative.

Sounds like a good idea to me.  The IBM DataPower convention is pretty
good too: it does not have a "member" element, but instead puts the
name associated with each value of an object in @name of the object
itself, thus:

JSON:  {"answer" : 43}

xmlsh:  <object><member name="answer"><number>43</></></>

DataPower: <object><number name="answer">43</></></>

I don't know half of you half as well           John Cowan
as I should like, and I like less than half     cowan@ccil.org
of you half as well as you deserve.             http://www.ccil.org/~cowan

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS