You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "Benson Margulies (JIRA)" <ji...@apache.org> on 2011/03/31 14:40:05 UTC

[jira] [Commented] (XMLSCHEMA-12) XmlSchemaCollection.init() should initialize simple types inheritance as specified in the specification.

    [ https://issues.apache.org/jira/browse/XMLSCHEMA-12?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13013949#comment-13013949 ] 

Benson Margulies commented on XMLSCHEMA-12:
-------------------------------------------

I'm concerned that something awful would happen here. XMLSchema has always been a pure representation system for schema, not a semantic system. 

> 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
>   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: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org