OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] Arbitrary grouping

[ Lists Home | Date Index | Thread Index ]

From: "Mitch Amiano" <mamiano@nc.rr.com>

> Using a Schematron approach might be appropriate
> in this case. Depending upon how arbitrary the 
> grouping is, it may be a more practical means 
> as opposed to permuting all the possible groupings. 

I would be a little stronger than that: I think it is generally impractical to 
use other schema languages for this: you may have some kind of
combinatorial explosion.  Furthermore, constraints such as
that the contents of one branch of a document will determine
the allowed elements in another branch of the document
typically cannot be done by regular-grammar-based systems.

{I say typically, because it also depends on how "ambigiuity" is handled:
some grammar-based systems such as WXS and DTDs say 
"based on what the parent is, this is what I expect in the children" while it
is possible to have a schema language that says "this is what I found in the
children, therefore this is what the parent is (or, at least, what the
following siblings may be)".  I think this is more how RELAX NG 
can act.}

> A better explanation is at 
> http://www.topologi.com/public/Schtrn_XSD/Paper.html
> See also
> http://www.topologi.com/products/validator/index.html

And also http://www.ascc.net/xml/schematron

To be more concrete, here is a Schematron rule that 
 1) constrains that there are 6 abcdef elements
 2) sets up simple partial ordering and existance requirement between these elements, 

<sch:rule context="x ">
    <sch:assert test= "count(.//a | .//b | .//c | .//d | .//e | .//f)=6">
         An x should contain directly or indirectly 6 abcdef elements.
    <sch:assert test=".//f [preceding::e[preceding::d[preceding::c[preceding::b
         Under an x, the elements abcdef should follow that order.

(This fairly terse. There are other ways to factor the constraints which would
allow better diagnostics and better efficiency, where these were an issue.)

Rick Jelliffe


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS