[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Arbitrary grouping


Re:  Arbitrary grouping
From: "Mitch Amiano" <mamiano@n...>


> 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>
    <sch:assert test=".//f [preceding::e[preceding::d[preceding::c[preceding::b
                    [preceding::a[ancestor::x=current()]]]]]]">
         Under an x, the elements abcdef should follow that order.
    </sch:assert>
</sch:rule>

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

Cheers
Rick Jelliffe


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.