Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » How do we make integer datatype behave like String data type in XML/XSD?(XML Type Redefinition)
icon3.gif  How do we make integer datatype behave like String data type in XML/XSD? [message #1229710] Fri, 10 January 2014 03:08 Go to next message
RIMD NA is currently offline RIMD NA
Messages: 1
Registered: January 2014
Junior Member
Idea

0 down vote favorite


I have the following XSD/XML type definition. It has been used by number of business units/applications.

<xsd:simpleType name="INDUSCodeType">
        <xsd:annotation>
            <xsd:documentation>INDUSCode</xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:integer">
            <xsd:minInclusive value="000001"/>
            <xsd:maxInclusive value="999000"/>
        </xsd:restriction>
    </xsd:simpleType>


As this one defined as "integer" data type, it strips the leading zeros of input. Eg: 0078 become 78 after parsing.

We need to pass the input as it is without stripping leading zeros eg 0078 become 0078 after parsing.

The ideal fix is to change the integer to string in restriction base. It is non-starter due to buy in from other groups.

You know we can redefine in COBOL Copy book such as F1 PIC 9(9) and redefines to PIC X(9) . As we consume redefined X(9), input parsed as it is without stripping zeros.

Is there a way to redefine in XML/XSD the above data type for desired outcome?

How do I do it?

Books and net dont seem to have helped too much either, so I am starting to question if this is theoretically possible at all

Thanks in helping.
Re: How do we make integer datatype behave like String data type in XML/XSD? [message #1229975 is a reply to message #1229710] Fri, 10 January 2014 17:53 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26054
Registered: July 2009
Senior Member
This forum is for asking questions about using the XSD model not about
how to design XML Schemas. The XML Schema specification defines that
the integer data type behaves the way you describe so if you need
something different, i.e., that leading zeros are somehow meaningful,
you can't use that data type. Of course you can always pad with leading
zeros yourself...


On 10/01/2014 3:43 PM, RIMD NA wrote:
> :idea:
> 0 down vote favorite
>
>
> I have the following XSD/XML type definition. It has been used by
> number of business units/applications.
>
> <xsd:simpleType name="INDUSCodeType">
> <xsd:annotation>
> <xsd:documentation>INDUSCode</xsd:documentation>
> </xsd:annotation>
> <xsd:restriction base="xsd:integer">
> <xsd:minInclusive value="000001"/>
> <xsd:maxInclusive value="999000"/>
> </xsd:restriction>
> </xsd:simpleType>
>
> As this one defined as "integer" data type, it strips the leading
> zeros of input. Eg: 0078 become 78 after parsing.
>
> We need to pass the input as it is without stripping leading zeros eg
> 0078 become 0078 after parsing.
>
> The ideal fix is to change the integer to string in restriction base.
> It is non-starter due to buy in from other groups.
>
> You know we can redefine in COBOL Copy book such as F1 PIC 9(9) and
> redefines to PIC X(9) . As we consume redefined X(9), input parsed as
> it is without stripping zeros.
>
> Is there a way to redefine in XML/XSD the above data type for desired
> outcome?
>
> How do I do it?
>
> Books and net dont seem to have helped too much either, so I am
> starting to question if this is theoretically possible at all
>
> Thanks in helping.
>
Previous Topic:Eclipse Validator Shows False errors
Next Topic:XSD Schema Editor Question
Goto Forum:
  


Current Time: Fri Sep 19 22:01:08 GMT 2014

Powered by FUDForum. Page generated in 0.01999 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software