 |
 |
 |
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@c...]
Sent: Fri 1/5/2007 2:19 AM
To: Watkins, Bill
Cc: xmlschema-dev@w...; Tsao, Scott
Subject: Re: regex help
Hi Bill,
Watkins, Bill <bill.watkins@b...> 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
|
 | 

|  |
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.
|  |
| |
 |
 |
 |