OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] How to use Pattern to restrict data

[ Lists Home | Date Index | Thread Index ]

 From: "Sean Zhang" <Sean.Zhang@ins.gte.com>
 
> I was using <pattern value="[0-9]{10}"/> so that only 10 digits will be
> acceptable. But I cannot find a way to exclude those numbers.  
> I looked on the web and cannot find a complete reference as how to use
> "pattern" and what are the possible symbols can be used in the "value"
> And what does each symbol mean.  (for example, I found some schema with "?"
> in value which means optional, also there are schemas specify "*", "|", etc
> in value but there are no explanation as what does each mean)
> 
> Can someone point me to a good reference with full explanation?
 
If you are using Xerces-J from Apache, you should also be aware that it 
has buggy regular expressions: | and ? don't actually work!  

 | should mean "the thing before or the thing after"
 ? should mean "that last thing is optional"

A fix was posted some time ago to Apache but never seems to have been incorporated.
(We just add the fix ourselves by hand when a new version of Xerces comes
out, for our product's use.)  This will have some impact on the reliability of Xerces 
datatyping: the fact that the bug does not seem to get reported much suggests that XML 
people don't check patterns much yet or maybe that they get confused about regular
expressions, perhaps wrongly attributing the problem to their own competence level
rather than to a bug.

Cheers
Rick Jelliffe




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS