|
Hello, I noticed that the method doesn't initialize inheritance model as specified in http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/datatypes.html#built-in-datatypes I am fixing this in my 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); } But probably it would be better to include in init() method ??? Kind Regards, Dmitry --
WARNING / LEGAL TEXT: This message is intended only for the use of the individual or entity to which it is addressed and may contain information which is privileged, confidential, proprietary, or exempt from disclosure under applicable law. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, you are strictly prohibited from disclosing, distributing, copying, or in any way using this message. If you have received this communication in error, please notify the sender and destroy and delete any copies you may have received. http://www.bsc.es/disclaimer.htm |
- [XmlSchema 2.0] XmlSchemaCollection.init() no inheritan... Dmitry Repchevsky
- Re: [XmlSchema 2.0] XmlSchemaCollection.init() no i... Benson Margulies
