Package org.nuxeo.ecm.core.schema
Class XSDLoader
java.lang.Object
org.nuxeo.ecm.core.schema.XSDLoader
Loader of XSD schemas into Nuxeo Schema objects.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final SchemaManagerImplprotected SchemaBindingDescriptor -
Constructor Summary
ConstructorsConstructorDescriptionXSDLoader(SchemaManagerImpl schemaManager) XSDLoader(SchemaManagerImpl schemaManager, boolean collectReferencedXSD) XSDLoader(SchemaManagerImpl schemaManager, SchemaBindingDescriptor sd) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcollectReferencedXSD(com.sun.xml.xsom.XSSchemaSet xsSchemas) protected TypecreateComplexType(Schema schema, ComplexType superType, String name, com.sun.xml.xsom.XSContentType content, boolean abstractType) protected TypecreateFakeComplexType(Schema schema, ComplexType superType, String name, com.sun.xml.xsom.XSModelGroup mg) protected static FieldcreateField(ComplexType type, com.sun.xml.xsom.XSAttributeDecl element, Type fieldType, boolean isNillable) protected static FieldcreateField(ComplexType type, com.sun.xml.xsom.XSElementDecl element, Type fieldType) protected ListTypecreateListType(Schema schema, String name, com.sun.xml.xsom.XSParticle particle) protected static ListTypecreateListType(Schema schema, String name, Type itemType, int min, int max) protected static StringgetAnonymousTypeName(com.sun.xml.xsom.XSType type, String fieldName) protected ObjectResolverServiceDeprecated.since 11.1.protected com.sun.xml.xsom.parser.XSOMParserprotected Typeprotected static StringgetTypeName(com.sun.xml.xsom.XSType type, String fieldName) protected static booleanisNillable(com.sun.xml.xsom.XSComponent component) protected static booleanisNillable(com.sun.xml.xsom.XSElementDecl element) ignore case where xsd:nillable is recognized as false by xsom (we don't know if it's not specified and we want to preserve a default value to true.protected voidloadAttributes(Schema schema, com.sun.xml.xsom.XSComplexType xsct, ComplexType ct) protected TypeloadComplexType(Schema schema, String name, com.sun.xml.xsom.XSType type) protected ListTypeloadListType(Schema schema, com.sun.xml.xsom.XSListSimpleType type, String fieldName) protected SchemaloadSchema(String name, String prefix, com.sun.xml.xsom.XSSchemaSet schemaSet, String xsdElement) protected SchemaloadSchema(String name, String prefix, com.sun.xml.xsom.XSSchemaSet schemaSet, String xsdElement, boolean isVersionWritable) loadSchema(String name, String prefix, File file) loadSchema(String name, String prefix, File file, String xsdElement) Called by schema manager.loadSchema(String name, String prefix, File file, String xsdElement, boolean isVersionWritable) loadSchema(String name, String prefix, URL url) loadSchema(String name, String prefix, URL url, String xsdElement) Create Nuxeo schema from a XSD resource.protected SimpleTypeloadSimpleType(Schema schema, com.sun.xml.xsom.XSType type, String fieldName) protected Typeprotected TypeprocessModelGroup(Schema schema, ComplexType superType, String name, ComplexType ct, com.sun.xml.xsom.XSModelGroup mg, boolean abstractType) protected voidregisterSchema(Schema schema)
-
Field Details
-
schemaManager
-
referencedXSD
-
collectReferencedXSD
protected boolean collectReferencedXSD -
sd
-
-
Constructor Details
-
XSDLoader
-
XSDLoader
-
XSDLoader
-
-
Method Details
-
getObjectResolverService
Deprecated.since 11.1. UseFramework.getService(Class)withObjectResolverServiceinstead. -
registerSchema
-
getType
-
getParser
protected com.sun.xml.xsom.parser.XSOMParser getParser() -
loadSchema
public Schema loadSchema(String name, String prefix, File file) throws SAXException, IOException, TypeException - Throws:
SAXExceptionIOExceptionTypeException
-
loadSchema
public Schema loadSchema(String name, String prefix, File file, String xsdElement) throws SAXException, IOException, TypeException Called by schema manager.- Throws:
SAXExceptionIOExceptionTypeException- Since:
- 5.7
-
loadSchema
public Schema loadSchema(String name, String prefix, File file, String xsdElement, boolean isVersionWritable) throws SAXException, IOException, TypeException - Parameters:
isVersionWritable- if true, the schema's fields will be writable even for Version document.- Throws:
SAXExceptionIOExceptionTypeException- Since:
- 8.4
-
collectReferencedXSD
protected void collectReferencedXSD(com.sun.xml.xsom.XSSchemaSet xsSchemas) -
loadSchema
public Schema loadSchema(String name, String prefix, URL url, String xsdElement) throws SAXException, TypeException Create Nuxeo schema from a XSD resource. If xsdElement is non null and correspont to the name of a complex element, the schema is created from the target complex type instead of from the global schema- Parameters:
name- schema nameprefix- schema prefixurl- url to load the XSD resourcexsdElement- name of the complex element to use as root of the schema- Throws:
SAXExceptionTypeException- Since:
- 5.7, 5.7
-
loadSchema
- Throws:
SAXExceptionTypeException
-
loadSchema
protected Schema loadSchema(String name, String prefix, com.sun.xml.xsom.XSSchemaSet schemaSet, String xsdElement) throws TypeException - Throws:
TypeException- Since:
- 8.4
-
loadSchema
protected Schema loadSchema(String name, String prefix, com.sun.xml.xsom.XSSchemaSet schemaSet, String xsdElement, boolean isVersionWritable) throws TypeException - Throws:
TypeException
-
loadType
protected Type loadType(Schema schema, com.sun.xml.xsom.XSType type, String fieldName) throws TypeBindingException - Parameters:
schema- the nuxeo schema into we register the type.type- the XSD type to loadfieldName- the field name owning this type, this is used when type is anonymous/local- Returns:
- the loaded type
- Throws:
TypeBindingException
-
loadComplexType
protected Type loadComplexType(Schema schema, String name, com.sun.xml.xsom.XSType type) throws TypeBindingException - Parameters:
name- the type name (note, the type may have a null name if an anonymous type)- Throws:
TypeBindingException
-
loadAttributes
protected void loadAttributes(Schema schema, com.sun.xml.xsom.XSComplexType xsct, ComplexType ct) throws TypeBindingException - Throws:
TypeBindingException
-
loadSimpleType
protected SimpleType loadSimpleType(Schema schema, com.sun.xml.xsom.XSType type, String fieldName) throws TypeBindingException - Throws:
TypeBindingException
-
loadListType
protected ListType loadListType(Schema schema, com.sun.xml.xsom.XSListSimpleType type, String fieldName) throws TypeBindingException - Throws:
TypeBindingException
-
createComplexType
protected Type createComplexType(Schema schema, ComplexType superType, String name, com.sun.xml.xsom.XSContentType content, boolean abstractType) throws TypeBindingException - Throws:
TypeBindingException
-
createFakeComplexType
protected Type createFakeComplexType(Schema schema, ComplexType superType, String name, com.sun.xml.xsom.XSModelGroup mg) throws TypeBindingException - Throws:
TypeBindingException
-
processModelGroup
protected Type processModelGroup(Schema schema, ComplexType superType, String name, ComplexType ct, com.sun.xml.xsom.XSModelGroup mg, boolean abstractType) throws TypeBindingException - Throws:
TypeBindingException
-
createListType
protected ListType createListType(Schema schema, String name, com.sun.xml.xsom.XSParticle particle) throws TypeBindingException - Throws:
TypeBindingException
-
createListType
-
createField
protected static Field createField(ComplexType type, com.sun.xml.xsom.XSElementDecl element, Type fieldType) -
createField
protected static Field createField(ComplexType type, com.sun.xml.xsom.XSAttributeDecl element, Type fieldType, boolean isNillable) -
getTypeName
-
getAnonymousTypeName
-
getReferencedXSD
-
isNillable
protected static boolean isNillable(com.sun.xml.xsom.XSElementDecl element) ignore case where xsd:nillable is recognized as false by xsom (we don't know if it's not specified and we want to preserve a default value to true. Therefore, we provide a custom attribute nxs:nillable to force nillable as false) NB: if xsd:nillable is present and sets to true, deducted value will be true even if nxs:nillable is false- Since:
- 7.1
-
isNillable
protected static boolean isNillable(com.sun.xml.xsom.XSComponent component)
-