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

> 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 UTC