NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Schematron? (Score:1)
Have you tried to combine Schematron with RELAX NG? It’s quite easily possible, as RNG has extension points that allow for such an undertaking, and Schematron gives you rule- as opposed to grammar-based validation. In short, Schematron rules are arbitrary XPath expressions that must match/be true in the contexts you specify for them. Particularly with suitable XPath extension functions, that lets you validate pretty much any kind of constraint whatsoever.
(You can also use Schematron standalone, but I find that defining full-blown grammars in terms of rules is much less readable. Declarative wins big in the areas where it can carry you. But Schematron is very nice not just for complementary purposes, but also because it’s descriptive rather than prescriptive, letting you validate aspects of a document as coarsely or finely grained as you need. Validity isn’t a binary concept.)
Another way to supercharge RNG is to use a different data type library – you aren’t limited to XSD (which is a pretty misshapen type system).
As for parsing the RELAX NG Compact syntax, why would you try? There is a corresponding XML vocabulary as well as tools such as Trang (yeah, Java, enh) which can translate one into the other. So you can turn an RNG grammar into a DOM that’s close enough to an AST for basically free.
RELAX NG and Schematron are both pretty cool stuff.
Reply to This
Re: (Score:2)
Actually, I have trang installed and used that to convert the compact grammar to XML. I had stuff like this:
And it was getting converted to this: