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
Modifier and TypeClassDescriptionprotected static class
protected static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected final SchemaManagerImpl
protected SchemaBindingDescriptor
-
Constructor Summary
ConstructorDescriptionXSDLoader
(SchemaManagerImpl schemaManager) XSDLoader
(SchemaManagerImpl schemaManager, boolean collectReferencedXSD) XSDLoader
(SchemaManagerImpl schemaManager, SchemaBindingDescriptor sd) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
collectReferencedXSD
(com.sun.xml.xsom.XSSchemaSet xsSchemas) protected Type
createComplexType
(Schema schema, ComplexType superType, String name, com.sun.xml.xsom.XSContentType content, boolean abstractType) protected Type
createFakeComplexType
(Schema schema, ComplexType superType, String name, com.sun.xml.xsom.XSModelGroup mg) protected static Field
createField
(ComplexType type, com.sun.xml.xsom.XSAttributeDecl element, Type fieldType, boolean isNillable) protected static Field
createField
(ComplexType type, com.sun.xml.xsom.XSElementDecl element, Type fieldType) protected ListType
createListType
(Schema schema, String name, com.sun.xml.xsom.XSParticle particle) protected static ListType
createListType
(Schema schema, String name, Type itemType, int min, int max) protected static String
getAnonymousTypeName
(com.sun.xml.xsom.XSType type, String fieldName) protected ObjectResolverService
Deprecated.since 11.1.protected com.sun.xml.xsom.parser.XSOMParser
protected Type
protected static String
getTypeName
(com.sun.xml.xsom.XSType type, String fieldName) protected static boolean
isNillable
(com.sun.xml.xsom.XSComponent component) 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.protected void
loadAttributes
(Schema schema, com.sun.xml.xsom.XSComplexType xsct, ComplexType ct) protected Type
loadComplexType
(Schema schema, String name, com.sun.xml.xsom.XSType type) protected ListType
loadListType
(Schema schema, com.sun.xml.xsom.XSListSimpleType type, String fieldName) protected Schema
loadSchema
(String name, String prefix, com.sun.xml.xsom.XSSchemaSet schemaSet, String xsdElement) protected Schema
loadSchema
(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 SimpleType
loadSimpleType
(Schema schema, com.sun.xml.xsom.XSType type, String fieldName) protected Type
protected Type
processModelGroup
(Schema schema, ComplexType superType, String name, ComplexType ct, com.sun.xml.xsom.XSModelGroup mg, boolean abstractType) protected void
registerSchema
(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)
withObjectResolverService
instead. -
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:
SAXException
IOException
TypeException
-
loadSchema
public Schema loadSchema(String name, String prefix, File file, String xsdElement) throws SAXException, IOException, TypeException Called by schema manager.- Throws:
SAXException
IOException
TypeException
- 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:
SAXException
IOException
TypeException
- 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:
SAXException
TypeException
- Since:
- 5.7, 5.7
-
loadSchema
- Throws:
SAXException
TypeException
-
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)
-