- From: Michael Kay <mike@saxonica.com>
- Date: Tue, 8 Aug 2006 17:16:58 +0100
- To: 'Luís Fernando Heckler' <lfheckler@ig.com.br>
- Cc: <xmlschema-dev@w3.org>
Firstly, XML Schema regular expressions are defined in the XML Schema spec, not the Python spec. Secondly, I think you've misread the spec. But I'm on vacation, so I'm not going to pursue it right now. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Luís Fernando Heckler [mailto:lfheckler@ig.com.br] > Sent: 08 August 2006 14:11 > To: Michael Kay > Cc: xmlschema-dev@w3.org > Subject: Re: xhtml.xsd error? > > Thanks Michael ! > > All right, this make sense, but the original Regular > Expression "[-+]?(\d+|\d+(\.\d+)?%)" doesn't match values > like "100.5%". > > At http://docs.python.org/lib/re-syntax.html we can read: > "|A|B|, where A and B can be arbitrary REs, creates a regular > expression that will match either A or B. An arbitrary number > of REs can be separated by the "|" in this way. This can be > used inside groups (see > below) as well. As the target string is scanned, REs separated by "|" > are tried from left to right. When one pattern completely > matches, that branch is accepted. This means that once |A| > matches, |B| will not be tested further, even if it would > produce a longer overall match. In other words, the "|" > operator is never greedy." > > So, the original expression match the substring "100" first and stop. > > An alternative could be: "[-+]?(\d+(\.\d+)?%|\d+)" > This recognize: > > 100 > 100% > 100.0% > +100 > +100% > +100.0% > -100 > -100% > -100.0% > > But also recognize strings like "1000000000.3332%" ... this > is correct, but weird. > > > Luís Fernando Heckler > > > > Michael Kay escreveu: > > This picture allows a decimal point only if there is a "%", > which seems > > reasonable, because you can't have a fractional number of pixels. > > > > Michael Kay > > http://www.saxonica.com/ > > > > > > > > > >> -----Original Message----- > >> From: xmlschema-dev-request@w3.org > >> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Luis > >> Fernando Heckler > >> Sent: 02 August 2006 20:01 > >> To: xmlschema-dev@w3.org > >> Subject: xhtml.xsd error? > >> > >> > >> Hi, > >> > >> I'm using the w3c xhtml.xsd to validate my xhtml document, > >> but I found something wrong: > >> > >> In the simpleType definition named Length (line 203), used to > >> validate de type of attributes width and heigth of table > >> element for example, we have a pattern to validate the type, > >> but this pattern doesn't match witch all the expected > formats (AFAIK). > >> > >> http://www.w3.org/TR/xhtml-modularization/abstraction.html#dt_ > >> Length say's: > >> "Length - The value may be either in pixels or a percentage > >> of the available horizontal or vertical space. Thus, the > >> value "50%" means half of the available space." > >> > >> The documentation comment in the xsd say's: > >> "nn for pixels or nn% for percentage length" > >> > >> So, I thing that expected values are: > >> 100 > >> 100.0 > >> 100% > >> 100.0% > >> +100 > >> +100.0 > >> +100% > >> +100.0% > >> -100 > >> -100.0 > >> -100% > >> -100.0% > >> > >> But the original pattern "[-+]?(\d+|\d+(\.\d+)?%)" don't > >> match all this length formats. > >> > >> I change to "[-+]?\d+(\.\d+)?%?" > >> > >> This is a error in original w3c xhtml.xsd or I'm wrong about > >> the expected length formats? > >> > >> Best wishes > >> Luis Fernando Heckler > >> > >> > >> > >> > >> > >> > > > > > > > > > >
Received on Tuesday, 8 August 2006 16:17:17 UTC