Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - Re: Defining recursive elements? [Thread Next] RE: Defining recursive elements?To: "'Todd Moon'" <tmrfcm@-----.--->, <xmlschema-dev@--.---> Date: 5/18/2007 12:18:00 AM > 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/ From mike@s... Thu May 17 22:23:34 2007 Received: fro | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
