|
[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] [XML Schema 1.1] Conflicting <assert> elements ... who wins?
From: Costello, Roger L. <costello@mitre.org>
Date: Tue, 30 Jun 2009 09:01:23 -0400 To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org> Message-ID: <9E51F88D5247B648908850C35A3BBB500400458C34@IMCMBX3.MITRE.ORG> Hi Folks, Suppose one <assert> element says "The value of <Publisher> must be a string no longer than 140 characters." Another <assert> element says "The value of <Publisher> must be a string no longer than 70 characters." Which <assert> element wins? Example: I have an <assert> element on the root element (<BarnesAndNoble>) which says "The value of each <Publisher> element must be a string no longer than 140 characters." I have another <assert> element directly on the <Publisher> element which says: "The value of <Publisher> must be a string no longer than 70 characters." Is <Publisher> constrained to a length of 140 characters or 70 characters? <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> <xs:element name="Publisher"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:assert test="not(string-length(.) gt 70)" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="Book"> <xs:complexType> <xs:sequence> <xs:element name="Title" type="xs:string"/> <xs:element name="Author" type="xs:string"/> <xs:element name="Date" type="xs:gYear"/> <xs:element name="ISBN" type="xs:string"/> <xs:element ref="Publisher" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="BarnesAndNoble"> <xs:complexType> <xs:sequence> <xs:element ref="Book" maxOccurs="unbounded" /> </xs:sequence> <xs:assert test="not(Book[string-length(Publisher) gt 140])" /> </xs:complexType> </xs:element> </xs:schema> /RogerReceived on Tuesday, 30 June 2009 13:02:03 GMT |
Subscribe in XML format
|

![[XML Schema 1.1] Conflicting <assert> elements ... who wins?](/images/get_stylus.gif)




