Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[xsd-dev] I can't get the Numeric Data Type for the current XSDSimpleTypeDefinition

Hello everyone! I try to get the Numeric DataType for the current XSDSimpleTypeDefinition element but I canít. With method XSDSimpleTypeDefinition.getPrimitiveTypeDefinition() I get the build-in Type definition for the current element, but when the element is other built-in type like integer, long, nonNegativeInteger, nonPositiveInteger, int, short, byte the this method is unuseful.The method XSDSimpleTypeDefinition.getBaseType() return the DataType of the parent element and not for current. The method XSDSimpleTypeDefinition.getName() brings the value but if the declaration of type is another simpleType the value is wrong. Example:

 

<xs:element name="direct-long" type="xs:long"/>

<xs:element name="direct-short" type="xs:short"/>

 

<xs:element name="link-long" type="link-long"/>

<xs:element name="link-short" type="link-short"/>

 

<xs:simpleType name="link-long">

   <xs:restriction base="xs:long">

            <xs:minInclusive  value="14000"/>

   </xs:restriction>

</xs:simpleType>

 

<xs:simpleType name="link-short">

   <xs:restriction base="xs:short">

            <xs:minInclusive  value="14"/>

   </xs:restriction>

</xs:simpleType>

 

One other idea is to get the BigDecimal Object of the XSDMaxInclusiveFacet and to find from this the current DataType. Example:

 

if (xsdFacet instanceof XSDMaxInclusiveFacet) {

      BigDecimal big (BigDecimal)((XSDMaxInclusiveFacet)xsdFacet).getValue();

}

       

Could anyone know how I can find the DataType for the current Element with easy way?

 

Thank you in advance.



Get news, entertainment and everything you care about at Live.com. Check it out!

Back to the top