- From: Watkins, Bill <bill.watkins@boeing.com>
- Date: Fri, 5 Jan 2007 10:48:10 -0600
- To: "Boris Kolpackov" <boris@codesynthesis.com>
- Cc: <xmlschema-dev@w3.org>, "Tsao, Scott" <scott.tsao@boeing.com>
Thanks, Boris, this looks like it does what I need. Thanks also to Michael and Xan for their help, and Scott Tsao for pointing me at this list. Bill Bill Watkins System of Systems Architect / Engineer Boeing Satellite Operations and Ground Systems - Houston "Any opinions expressed are my own and do not reflect those of Boeing." "For every complex problem, there is a solution that is simple, neat, and wrong." HL Mencken ________________________________ From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Fri 1/5/2007 2:19 AM To: Watkins, Bill Cc: xmlschema-dev@w3.org; Tsao, Scott Subject: Re: regex help 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 <http://www.codesynthesis.com/> Open-Source, Cross-Platform C++ XML Data Binding
Received on Friday, 5 January 2007 16:50:36 UTC