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

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

From: Pete Cordell <petexmldev@tech-know-ware.com>
Date: Tue, 21 Feb 2006 20:36:53 -0000
Message-ID: <003401c63726$90057700$b100a8c0@RW>
To: <public-xsd-databinding@w3.org>, <Paul.V.Biron@kp.org>

Hi Paul,

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+).

It's these that I'm more worried about, but I'm not sure if you want to 
promote these or not.

Cheers,

Pete.
----- Original Message ----- 
From: <Paul.V.Biron@kp.org>
To: <public-xsd-databinding@w3.org>
Sent: Tuesday, February 21, 2006 7:49 PM
Subject: ISSUE-8: MUST allow pattern on all types


>
> I thought I had posted something on this issue a long time ago...but a
> quick check of the archives didn't turn anything up.  So, here goes.
>
> I completely recognize the problem the schema spec created by allowing the
> pattern facet on non-string types...and I argued against it during the
> development of that spec.
>
> However, the databinding spec can NOT disallow this because the following
> is a very useful type  that uses pattern on a numberic type:
>
> <xs:simpleType name='oddIntegers'>
>        <xs:restriction base='xs:integer'>
>                <xs:pattern value='[\-+]?\d*[13579]'/>
>        </xs:restriction>
> </xs:simpleType>
>
> There is no other way to define the type whose value space is "the odd
> integers" and I'm told that such types exist in schemas-in-the-wild.
>
> So, serializers just need to become smarter than they currently are.  Yes,
> it is real pain to have to serialize pathological cases like:
>
> <xs:simpleType name='myInt'>
>        <xs:restriction base='xs:integer'>
>                <xs:pattern value='(0+|23[284]+)?\d*'/>
>        </xs:restriction>
> </xs:simpleType>
>
> that are no problem at all for validation.
>
> But again, this WG is NOT about changing the schema spec...it is about
> helping binding tools support the schema spec as it exists.  I am all for
> this WG educating schema authors about the difficulties they cause binding
> tools when they create pathological cases like myInt above...but to
> disallow them is not within our charter.
>
> Also note, the serialization problems caused by pattern are not restricted
> to the numeric types (which is why I always say "non-string types").
> Technically gYear, etc. are not numeric types but that have all the same
> problems as integer.  Don't forget that pattern on the binary types is
> also problematic!  But again, it's allowed by the schema spec!
>
> pvb
>
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
                         for XML to C++ data binding visit
                         http://www.tech-know-ware.com/lmx
                         (or http://www.xml2cpp.com)
=============================================
Received on Tuesday, 21 February 2006 20:37:09 GMT

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