I’m a big proponent of XML for document coding and data exchange. Indeed, my new project exploits these technologies quite heavily.
However, I’m sympathetic to the critique that XML is overkill in certain contexts. Still, when reading comments like this from a JSON website, I have to cringe a little:
JSON promises the same benefits of interoperability and openness, but without the disadvantages.
Before the XML-Sucks-and-JSON/YAML-Nirvana crowds get too cocky, though, they ought to admit they’re missing at least one big — in some cases HUGE — feature that XML has: validation support. I’ve been playing with a YAML representation of my CSL schema, which looks something like this:
class: author-year
info:
title: Chicago
content:
terms:
roles:
editors: {single: 'ed.', multiple: 'eds.'}
translators: {single: 'tran.', multiple: 'trans.'}
dates:
months: {1: Jan, 2: Feb, 3: Mar, 4: Apr, 5: May, 6: Jun, 7: Jul,
8: Aug, 9: Sep, 10: Oct, 11: Nov, 12: Dec}
citation:
delimeter: '; '
entry: [
creator: [names-short: {suffix: ''},
yearIssued,
locator: [{prefix: ':'}, numbers]
]
]
bibliography:
article: [
creator: [names, role: {prefix: ''}],
yearIssued: {prefix: '(', suffix: ')'},
title,
container: [
title: {font-style: italic},
locators: [volume, issue, pages]
]
]
book: [
creator: [names, role: {prefix: ''}],
yearIssued: {prefix: '(', suffix: ')'},
title,
container: {prefix: 'In '},
[
title: {font-style: italic},
locators: [volume, issue, pages]
]
]
[Note: some heavy-duty funkiness in the above rendering; not sure why.]
Yes, it’s nice and compact, and yes, all the dynamic languages have good YAML parsers that will virtually instantaneously map those to native structures (arrays, hashes, objects).
But … and this is big “but”: it’s a PITA to code by hand in this case. It took me ages just to get file that wouldn’t cause the Ruby YAML parser to choke. And that doesn’t even deal with content validation!
What would be nice is to see something like RELAX NG-Compact used as a validation schema language for YAML and JSON. Then things could get really interesting!
Oh, and how about namespaces?