[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XML Schema quiz: 3 elements and at least one must bepresen
I once had a variation on this: it was for new reports where each document had to have elements for <what>, <where>, <when>, <who> (and <how>), which a journalism professor was teaching as the essential elements that every professional story needed to provided. So the constraints: five elements, where the document needed to have at least one of each in any order. The killer? The elements could be anywhere in the news report. Obviously Schematron can do this trivially <rule context="/"> <assert test="//what">A document should have at least one what </assert> <assert test="//where">A document should have at least one where </assert> <assert test="//when">A document should have at least one when </assert> <assert test="//who">A document should have at least one who </assert> <assert test="//how">A document should have at least one how</assert> </rule> but it is not something that grammars (or, at least, grammars with non-path particles) can do. Even in the case of XSD 1.1 assertions, which are a great addition (perhaps in the way that a cheesecake is great after a 50 course meal of crackers) it is difficult, because these are not constraints that belong to types. They are constraints of the document of a class rather than of any elements: so in XSD you would have to artificially tie these to, say, a top-level element. In XSD it cannot be expressed as a pattern that exists in isolation from other particulars of the document. The pattern concept is more general than the type concept. Cheers Rick Jelliffe
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
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
|