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

RE: Defining recursive elements?

From: Michael Kay <mike@saxonica.com>
Date: Thu, 17 May 2007 23:17:30 +0100
To: "'Todd Moon'" <tmrfcm@gmail.com>, <xmlschema-dev@w3.org>
Message-ID: <019e01c798d1$291690c0$6401a8c0@turtle>
RE: Defining recursive elements?

> With global definitions some documents will be valid that you might 
> not want, for example an XML document of just <header/> 
> would validate using that schema.

I think it's a mistake to make elements local simply because you think there
will never be a requirement to use them as a validation root. In principle a
schema validator should give you the opportunity to say what element
declaration you want to validate against when you invoke validation.
Admittedly not all products offer that ability (Saxon doesn't, except via
some very low level API calls, until the next release), but they should. In
the meantime it's not really that hard to apply two conditions: (a) the
document must be valid, and (b) its outermost element must be X.

Again, once you start using schema-aware queries and stylesheets you find
yourself validating at a much finer level of granularity, and if you haven't
left that possibility open in the schema, then you're constrained. In XSLT
you can always validate against a global type instead, but even that option
isn't available in XQuery.

Michael Kay
http://www.saxonica.com/
Received on Thursday, 17 May 2007 22:17:39 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
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-2007 All Rights Reserved.