09-29-2006, 09:37 AM | #1 (permalink) |
Free Mars!
Location: I dunno, there's white people around me saying "eh" all the time
|
[xml] Invalid Pattern
I've tested the pattern epxression in QuickREX for eclipse and it stated that the pattern is correct for American and Canadian Postal Code
Code:
<xsd:simpleType name="PostalFormat"> <xsd:restriction base="xsd:string"> <xsd:pattern value="(\d{5})(-\d{4})?"/> <xsd:pattern value="([ABCEGHJKLMNPRSTVXY]\d[A-Z](( )*|-)/?\d[A-Z]\d)$"/> </xsd:restriction> </xsd:simpleType> ... <xsd:element name="postal-code" type="PostalFormat"/> Code:
<xsd:simpleType name="PostalFormat"> <xsd:restriction base="xsd:string"> <xsd:pattern value="(\d{5})(-\d{4})?|([ABCEGHJKLMNPRSTVXY]\d[A-Z]( |-)?\d[A-Z]\d)$"/> </xsd:restriction> </xsd:simpleType>
__________________
Looking out the window, that's an act of war. Staring at my shoes, that's an act of war. Committing an act of war? Oh you better believe that's an act of war |
10-06-2006, 09:09 AM | #2 (permalink) |
Psycho
Location: sc
|
i think its one pattern per element.
so, its looking for a pattern that wholly fits the first pattern or wholly fits the second, not a combination of both. but when you combine the two patterns into one in the second snippet, it is successful. i'm not an xml expert, though, could be wrong.
__________________
This is what is hardest: to close the open hand because one loves.
Nietzsche |
10-06-2006, 09:18 AM | #3 (permalink) |
Free Mars!
Location: I dunno, there's white people around me saying "eh" all the time
|
Well I've looked up multiple patterns for a single element and found that it was allowed, I even asked my instructor about that. The source code that I posted is very similar to another one on a different forum where the poster said it works.
__________________
Looking out the window, that's an act of war. Staring at my shoes, that's an act of war. Committing an act of war? Oh you better believe that's an act of war |
10-07-2006, 06:39 AM | #4 (permalink) | |
Psycho
Location: sc
|
Quote:
__________________
This is what is hardest: to close the open hand because one loves.
Nietzsche |
|
10-07-2006, 07:24 PM | #5 (permalink) |
Free Mars!
Location: I dunno, there's white people around me saying "eh" all the time
|
No, the pattern is acceptable for US postal code but when it comes to Canadian postal code, the reader it goes nuts on it
__________________
Looking out the window, that's an act of war. Staring at my shoes, that's an act of war. Committing an act of war? Oh you better believe that's an act of war |
Tags |
invalid, pattern, xml |
|
|