- From: Boris Kolpackov <boris@codesynthesis.com>
- Date: Fri, 5 Jan 2007 10:19:28 +0200
- To: "Watkins, Bill" <bill.watkins@boeing.com>
- Cc: xmlschema-dev@w3.org, "Tsao, Scott" <scott.tsao@boeing.com>
Hi Bill, Watkins, Bill <bill.watkins@boeing.com> writes: > <QuotedStringList> > "your dog.my_dog" "my_cat$your_cat" > "their_rat" > </QuotedStringList> > > [...] > > <xs:simpleType name="QUOTEDNAME_TYPE"> > <xs:restriction base="xs:string"> > <xs:pattern value='\s*"\S([^"]|\s)+\S"\s*'/> > </xs:restriction> > </xs:simpleType> > > <xs:simpleType name="QUOTEDNAMELIST_TYPE"> > <xs:list itemType="QUOTEDNAME_TYPE"/> > </xs:simpleType> The list-based approach won't works since you can have whitespaces inside list values. In the example above your list will be chopped up as follows: '"your' 'dog.my_dog"' '"my_cat$your_cat"' '"their_rat"'. > <xs:simpleType name="listOfQuotedStrings"> > <xs:restriction base="xs:string"> > <xs:pattern value='(("[^"]*")\s+)*'/> > </xs:restriction> > </xs:simpleType> This one won't work since it expects at least one whitespace after a quoted string, even the last one. > <xs:simpleType name="listOfQuotedStrings"> > <xs:restriction base="xs:string"> > <xs:pattern value='("[^"]*"(\s+"[^"]*")*)?'/> > </xs:restriction> > </xs:simpleType> This one is almost there. The only thing you need to add is optional whitespaces before the first quoted string and after the last (note the newlines after <QuotedStringList> and before "your dog.my_dog" as well as after "their_rat" and before </QuotedStringList> -- they are part of the value): <xs:pattern value='(\s*"[^"]*"(\s+"[^"]*")*\s*)?'/> hth, -boris -- Boris Kolpackov Code Synthesis Tools CC http://www.codesynthesis.com Open-Source, Cross-Platform C++ XML Data Binding
Received on Friday, 5 January 2007 08:36:34 UTC