W3C home > Mailing lists > Public > public-xsd-databinding@w3.org > February 2006

Re: ISSUE-8: MUST allow pattern on all types

From: <Paul.V.Biron@kp.org>
Date: Wed, 22 Feb 2006 10:11:45 -0800
To: petexmldev@tech-know-ware.com
Cc: public-xsd-databinding@w3.org
Message-Id: <OF3AF6810A.C6D98C53-ON8825711D.00631946-8825711D.0063F24B@KP.ORG>

> I don't think there is a problem when the integers match canonical 
forms. 
> Certainly your first example matches the canonical form, as does your 
second 
> one, but I'm not sure if that is the intent.

> Bigger problems happen when the desired output is something like 001, 
002, 
> 003 etc.  (e.g. \d{3}), or requiring the + or - sign (e.g. [-+]\d+).

Actually, my second example did NOT match a canonical form:

        <xs:simpleType name='myInt'>
             <xs:restriction base='xs:integer'>
                     <xs:pattern value='(0+|23[284]+)?\d*'/>
             </xs:restriction>
        </xs:simpleType>

Note the 0+ at the start.  Well, I guess since I made it optional, you 
could ignore it...so, change that to:

        <xs:simpleType name='myInt'>
             <xs:restriction base='xs:integer'>
                     <xs:pattern value='0+(23[284]+)?\d*'/>
             </xs:restriction>
        </xs:simpleType>

and then it is basically the same as your \d{3} case.

What problem could be caused by requiring the sign?  Which was optional in 
my first example.

I realize that it is not always easy to serialize some pathological 
cases...but again, I think it is unacceptable for this WG to tell 
implementors that it is OK to not support some aspect of the schema spec.

Luckily I don't have to do it...but I'm sure some smart person could write 
an algorithm that translated a schema regex into an sprintf format string, 
couldn't they?

pvb
Received on Wednesday, 22 February 2006 18:12:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 18 December 2010 18:20:36 GMT