[Catalyst] OT: XML validation languages (was: YAML vs. *)
A. Pagaltzis
pagaltzis at gmx.de
Mon Jun 12 20:40:26 CEST 2006
* Kiki <kiki at bsdro.org> [2006-06-12 16:55]:
> The nice thing about XML validation standards is that there are
> so many to choose from. You have DTDs, XML Schema and
> Schematron and while I managed to get a grasp on XML Schema, I
> couldn't bring myself to learn more of them. Writing XSD is no
> joy to me (as it's XML too), but hey, if it's someone else that
> does the writing, I wholeheartedly agree ;)
Ugh. XSD is the worst of the bunch by a mile. It’s an overgrown
design-by-committee beast of festering complexity. Do yourself a
favour and learn RELAX NG as well as Schematron.
RELAX NG is basically DTDs, only 3× more expressive. It can be
expressed either in an XML dialect (which is pretty nice for XML
apps) or with a “Compact” grammar which has a programmish
look&feel (brace-delimited blocks etc). Very nice. The way XML
schemas were meant to be.
Schematron is dead simple: you write a bunch of assertions in the
form of XPath expressions. That’s all. It is extremely powerful
despite its simplicity: the only schema language which can deal
with arbitrarily complicated co-constraints, constraints varying
on attribute values or element content and the like. Because it’s
assertive rather than declarative it can also be used both by
itself as well as on top of another schema language. There are
annotation mechanisms in both XSD and RNG which can be used to
embed Schematron assertions in XSD/RNG schemata. It’s neat.
Seriously, XML validation can be much less hateful than XSD.
Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>
More information about the Catalyst
mailing list