Re: [xml-dev] XML Redux
I like Dave Pawson's use of the <> as formal markup delimiters, but I'd still kind of point to the XQuery XDM and question whether, with a few syntactic shortcuts you couldn't get something that still satisfies the XDM while at the same time giving you a JSON-esque notation. Consider the following:
("This is a test",<foo>This is <bar>an element</bar> inside an element</foo>,12,25,<bin bat="term">More text</bin>)
Rewrite this in XQuery constructor notation:
("This is a test", element foo {('This is ',element bar {'an element'},' inside an element.')},12,25,element bin {(attribute bat {"term"},"More text"}))
Replace element foo with *foo: (), attribute bar with @bar: () :
("This is a test",*foo: ("This is ",*bar: ('an element'),'inside an element'),12,25,*bin: (@bar: "term","More text"))
You could even go a step further by assuming that the constructs *foo: () automatically "escapes out" of text. Additionally sequence items that need to be separated could be placed in a [] structure:
(This is a test *foo: (This is *bar: (an element) inside an element),[12,25],*bin: (@bar: (term) More text))
HTML would be encoded as *html: (*head: (*title: (This is the top title) *link: (@rel: (stylesheet) @href:(my.css)) *body: (*h1: (This is the page title) *p:(This is a *b: (test).)))
Finally, it may be possible to eliminate the * notation altogether:
html: (head: (title: (This is the top title) link: (@rel: (stylesheet),@href: (my.css)) body: (h1: (This is the page title) p: (This is a b: (test).)))
This doesn't break XML, beyond the document vs. grove issue (which has always been one of the more questionable characteristics of the XML spec), is compact, more or less readable, and can be readily mapped to JSON. For instance, consider a structure of the form:
For instance, a list of strings could be differentiated with []:
colors: (["red","green","blue","yellow"])
JSON would interpret this as:
{colors: ["red","green","blue","yellow"]}
while XML would interpret it as
<colors xsi:type="xs:NMTokens">red green blue yellow</colors>
or, worst case:
<colors>
<xml:null>red</xml:null>