Re: Specifying formal semantics in XML languages
[Resend due to finger trouble, with additions] There are indeed many useful kinds of schema languages that don't have widespread currency yet. In some of my company's products we use our own little schema language that says * what elements are allowed or required * what attributes are allowed or required * what elements are only every found in first or last position We also have "usage schemas" which sample documents and generate all the possible grandparent/parent/child paths in the document, and checks other documents against these. Checking lists of tokens is indeed a very problematic area for Schematron using the default XSLT 1 implementations. ISO DSDL was created to give a home and official status to these kind of little languages. If anyone can come up with a technically excellent and implemented little schema language that helps validate some significant kinds of markup idioms that XSD or the other ISO DSDL schema languages do not cover well (as is *entirely* possible), I am certain the ISO SC34 WG1 group would be interested in considering it for standardization, in typically unpanicked fashion. To be honest, I suspect that Schematron with a particular extension could pretty much do what Peter requires. In particular, ISO Schematron has a macro facility called abstract patterns that allow you to be much more declarative in labelling the participants in a schema relationship: you could have one like <sch:pattern name="required-child" abstract="true"> <sch:rule context="$parent"> <sch:assert test="$child">The parent should have a child</sch:assert> </sch:rule> </sch:pattern> where the $ tokens are macro arguments that are replaced by their invocation to give conventional Schematron schemas <sch:pattern name="eg" is-a="required-child"> <sch:param name="parent" value="Angela"/> <sch:param name="child" value="Suhai"/> <sch:param name="position" value="1" /> </sch:pattern> What this gives is enough markup that a custom processor can take the schema and generate code based on it. For example, to append a Suhai element to the Angela element in the first position. In fact, you might even decide not to ever validate using the Schematron schema per se, (use it as documentation) but to drive your superduper custom processor with the information specified using abstract patterns! Abstract patterns represent, I hope, a significant advance in home-made schema languages, because not only do you get the background boring power of XPath validation, but you also get the extra labelling required to enable identification of the parts of constraints and assertion tests. And that identification opens the door for re-targetting the schema for purposes such as code generation or any kind of useful purpose. XPaths are great because they are terse; abstract patterns overcome the concomitant lack of declative expressiveness. Cheers Rick >
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format