It's a validation issue. I have a packed
decimal number with ranges 0-100, 200-300, 400-500. I can't parse and validate
this with DFDL. WTX can handle this today.
Regards
Steve Hanson
Programming Model Architect
WebSphere Message Brokers
Hursley, UK
Internet: smh@uk.ibm.com
Phone (+44)/(0) 1962-815848
DFDL <mbeckerle.dfdl@gmail.com>
07/03/2009 04:49
|
To
| Steve Hanson/UK/IBM@IBMGB
|
cc
| "dfdl-wg@ogf.org" <dfdl-wg@ogf.org>
|
Subject
| Re: [DFDL-WG] Numbers with multiple
ranges |
|
What does this have to do with representation/ format
?
Seems totally out of scope to me.
...mikeb
On Mar 6, 2009, at 12:18 PM, Steve Hanson <smh@uk.ibm.com>
wrote:
One of the existing non-XML parsers from IBM is capable of modelling an
integer or decimal with non-contiguous ranges, eg, 0-100, 200-300, 400-500.
It is also possible to model this using XML Schema, using a user-defined
simple type which is a union of simple type restrictions.
However it is not possible to model this in DFDL because unions are not
supported. A choice could be used, but that would give different named
elements in the resultant infoset depending on the value, which is not
ideal.
I believe this is use case that we should consider for DFDL 1.0. We
could decide to allow unions, but with a constraint that the members of
the union had to be restrictions of the same built-in type, and that clashing
DFDL properties on the members was an error. I believe the existing scoping
rules for visiting types would still apply ok. No annotation appears on
the xs:union only on the xs:simpleType as currently. The net effect is
that our parsing rules are the same as currently, but we gain validation
capability.
I am not in favour of more widespread support for unions. I don't have
a compelling use case for union of different logical types, eg, xs:dateTime
and xs:string.
Your thoughts are welcome.
!-- integer range 0 - 100
<xsd:simpleType name="intRange1">
<xsd:restriction base="xsd:int">
<xsd:maxInclusive value="100"/>
<xsd:minInclusive value="0"/>
</xsd:restriction>
</xsd:simpleType>
!-- integer range 200 - 300
<xsd:simpleType name="intRange2">
<xsd:restriction base="xsd:int">
<xsd:maxInclusive value="300"/>
<xsd:minInclusive value="200"/>
</xsd:restriction>
</xsd:simpleType>
!-- integer range 400-500
<xsd:simpleType name="intRange3">
<xsd:restriction base="xsd:int">
<xsd:maxInclusive value="500"/>
<xsd:minInclusive value="400"/>
</xsd:restriction>
</xsd:simpleType>
!-- Union of above types
<xsd:simpleType name="intRange">
<xsd:union memberTypes="intRange1 intRange2 intRange3"/>
</xsd:simpleType>
!-- Union of anonymous types being restrictions of above types
<xsd:simpleType name="intRangeLocal">
<xsd:union>
<xsd:simpleType>
<xsd:restriction base="intRange1"/>
</xsd:simpleType>
<xsd:simpleType>
<xsd:restriction base="intRange2"/>
</xsd:simpleType>
<xsd:simpleType>
<xsd:restriction base="intRange3"/>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
!-- Union of anonymous types being local restrictions
<xsd:simpleType name="intRangeLocalRestrictions">
<xsd:union>
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="100"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:minInclusive value="200"/>
<xsd:maxInclusive value="300"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType>
<xsd:restriction base="xsd:int">
<xsd:minInclusive value="400"/>
<xsd:maxInclusive value="500"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
Regards
Steve Hanson
Programming Model Architect
WebSphere Message Brokers
Hursley, UK
Internet: smh@uk.ibm.com
Phone (+44)/(0) 1962-815848
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU
--
dfdl-wg mailing list
dfdl-wg@ogf.org
http://www.ogf.org/mailman/listinfo/dfdl-wg
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU