[
https://issues.apache.org/jira/browse/XMLSCHEMA-12?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dmitry Repchevsky updated XMLSCHEMA-12:
---------------------------------------
Attachment: fnroyOcPjyUAAAAASUVORK5CYII=
Well this is not much different from having build-in datatypes in XMLSchema.
I mean if we had
<xs:simpleType name="mytype">
<xs:restriction base="xs:long"/>
</xs:simpleType>
we already know that xs:long is, but still can get a primitive type for it.
On the other hand having a XmlSchemaSimpleType for it we can't infer
whether it is "xs:integer" or no...
It's just that the specification states that build-in datatypes have
hierarchy and someone would expect it not only for parsed complex types...
Kind regards,
Dmitry
--
------------------------------------------------------------------------
Barcelona Supercomputing Center National Institute of Bioinformatics,
Life Science, Computational Node 6
Nexus II, Jordi Girona 29, 08034 Barcelona, Spain
> XmlSchemaCollection.init() should initialize simple types inheritance as
> specified in the specification.
> --------------------------------------------------------------------------------------------------------
>
> Key: XMLSCHEMA-12
> URL: https://issues.apache.org/jira/browse/XMLSCHEMA-12
> Project: XmlSchema
> Issue Type: Improvement
> Affects Versions: XmlSchema 2.0
> Reporter: Dmitry Repchevsky
> Priority: Trivial
> Attachments: fnroyOcPjyUAAAAASUVORK5CYII=
>
> Original Estimate: 20m
> Remaining Estimate: 20m
>
> http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/datatypes.html#built-in-datatypes
> predefine an inheritance for build-in datatypes.
> Probably it could be better to include into XmlSchemaCollection.init() method
> something like:
> fixDatatypes(xsd);
> [CODE]
> private void fixDatatypes(XmlSchema schema)
> {
> setSimpleTypeRestriction(schema, Constants.XSD_ANYSIMPLETYPE,
> Constants.XSD_ANYTYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_DURATION,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_DATETIME,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_TIME,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_DATE,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_YEARMONTH,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_YEAR,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_MONTHDAY,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_DAY,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_MONTH,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_BOOLEAN,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_BASE64,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_HEXBIN,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_FLOAT,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_DOUBLE,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_ANYURI,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_QNAME,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_NOTATION,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_NOTATION,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_DECIMAL,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_INTEGER,
> Constants.XSD_DECIMAL);
> setSimpleTypeRestriction(schema, Constants.XSD_NONPOSITIVEINTEGER,
> Constants.XSD_INTEGER);
> setSimpleTypeRestriction(schema, Constants.XSD_NEGATIVEINTEGER,
> Constants.XSD_NONPOSITIVEINTEGER);
> setSimpleTypeRestriction(schema, Constants.XSD_LONG,
> Constants.XSD_INTEGER);
> setSimpleTypeRestriction(schema, Constants.XSD_INT,
> Constants.XSD_LONG);
> setSimpleTypeRestriction(schema, Constants.XSD_SHORT,
> Constants.XSD_INT);
> setSimpleTypeRestriction(schema, Constants.XSD_BYTE,
> Constants.XSD_SHORT);
> setSimpleTypeRestriction(schema, Constants.XSD_NONNEGATIVEINTEGER,
> Constants.XSD_INTEGER);
> setSimpleTypeRestriction(schema, Constants.XSD_POSITIVEINTEGER,
> Constants.XSD_NONNEGATIVEINTEGER);
> setSimpleTypeRestriction(schema, Constants.XSD_UNSIGNEDLONG,
> Constants.XSD_NONNEGATIVEINTEGER);
> setSimpleTypeRestriction(schema, Constants.XSD_UNSIGNEDINT,
> Constants.XSD_UNSIGNEDLONG);
> setSimpleTypeRestriction(schema, Constants.XSD_UNSIGNEDSHORT,
> Constants.XSD_UNSIGNEDINT);
> setSimpleTypeRestriction(schema, Constants.XSD_UNSIGNEDBYTE,
> Constants.XSD_UNSIGNEDSHORT);
> setSimpleTypeRestriction(schema, Constants.XSD_STRING,
> Constants.XSD_ANYSIMPLETYPE);
> setSimpleTypeRestriction(schema, Constants.XSD_NORMALIZEDSTRING,
> Constants.XSD_STRING);
> setSimpleTypeRestriction(schema, Constants.XSD_TOKEN,
> Constants.XSD_NORMALIZEDSTRING);
> setSimpleTypeRestriction(schema, Constants.XSD_LANGUAGE,
> Constants.XSD_TOKEN);
> setSimpleTypeRestriction(schema, Constants.XSD_NMTOKEN,
> Constants.XSD_TOKEN);
> setSimpleTypeRestriction(schema, Constants.XSD_NAME,
> Constants.XSD_NMTOKEN);
> setSimpleTypeRestriction(schema, Constants.XSD_NCNAME,
> Constants.XSD_TOKEN);
> setSimpleTypeRestriction(schema, Constants.XSD_ID,
> Constants.XSD_NCNAME);
> setSimpleTypeRestriction(schema, Constants.XSD_IDREF,
> Constants.XSD_NCNAME);
> setSimpleTypeRestriction(schema, Constants.XSD_ENTITY,
> Constants.XSD_NCNAME);
> setSimpleTypeList(schema, Constants.XSD_NMTOKENS,
> Constants.XSD_NMTOKEN);
> setSimpleTypeList(schema, Constants.XSD_IDREFS, Constants.XSD_IDREF);
> setSimpleTypeList(schema, Constants.XSD_ENTITIES,
> Constants.XSD_ENTITY);
> }
> private static void setSimpleTypeRestriction(XmlSchema schema, QName
> child, QName parent)
> {
> XmlSchemaSimpleType simple =
> (XmlSchemaSimpleType)schema.getTypeByName(child);
> XmlSchemaSimpleTypeRestriction restriction = new
> XmlSchemaSimpleTypeRestriction();
> restriction.setBaseTypeName(parent);
>
> restriction.setBaseType((XmlSchemaSimpleType)schema.getTypeByName(parent));
> simple.setContent(restriction);
> }
> private void setSimpleTypeList(XmlSchema schema, QName child, QName
> parent)
> {
> XmlSchemaSimpleType simple =
> (XmlSchemaSimpleType)schema.getTypeByName(child);
> XmlSchemaSimpleTypeList restriction = new XmlSchemaSimpleTypeList();
> restriction.setItemTypeName(parent);
>
> restriction.setItemType((XmlSchemaSimpleType)schema.getTypeByName(parent));
> simple.setContent(restriction);
> }
> [CODE]
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]