Interface SchemaTypeLoader
-
- All Known Subinterfaces:
SchemaTypeSystem
- All Known Implementing Classes:
BuiltinSchemaTypeSystem
,SchemaTypeLoaderBase
,SchemaTypeLoaderImpl
,SchemaTypeSystemImpl
,SoapEncSchemaTypeSystem
,TypeSystemHolder
,XQuerySchemaTypeSystem
public interface SchemaTypeLoader
Represents a searchable set of XML Schema component definitions.SchemaTypeLoader is somewhat analogous to
ClassLoader
, because it is responsible for findingSchemaComponent
definitions by name, yet it is not responsible for being able to enumerate all the component definitons available. (If you wish to enumerate component definitions, seeSchemaTypeSystem
.) There are some ways in which SchemaTypeSystems are dissimilar from ClassLoaders, however. Since XML Schema has a number of instance-oriented typing mechanisms (such as wildcards) that do not exist in Java, a SchemaTypeLoader is not associated with a type; instead, a SchemaTypeLoader is associated with each XML instance.Every XML instance is loaded within the context of a SchemaTypeLoader; the SchemaTypeLoader for an instance is used to resolve all type definitions within the instance and for applying type-sensitive methods such as
XmlObject.validate()
.Normally the SchemaTypeLoader being used for all instances is the context type loader (that is, the SchemaTypeLoader returned from
XmlBeans.getContextTypeLoader()
). The context type loader consults the thread's context ClassLoader (seeThread.getContextClassLoader()
) to find schema type defintions that are available on the classpath. The net result is that you can use schema types simply by putting their compiled schema JARs on your classpath. If you wish to load instances using a different SchemaTypeLoader, then you must callparse(java.lang.String, org.apache.xmlbeans.SchemaType, org.apache.xmlbeans.XmlOptions)
methods on the SchemaTypeLoader instance explicitly rather than using the normal convenient Factory methods.A SchemaTypeLoader can be obtained by dynamically loading XSD files using
XmlBeans.loadXsd(org.apache.xmlbeans.XmlObject...)
, or by assembling other SchemaTypeLoaders or SchemaTypeSystems on a path usingXmlBeans.typeLoaderUnion(org.apache.xmlbeans.SchemaTypeLoader...)
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
compilePath(java.lang.String pathExpr, XmlOptions options)
Compiles an XPathjava.lang.String
compileQuery(java.lang.String queryExpr, XmlOptions options)
Compiles an XQuerySchemaGlobalAttribute
findAttribute(javax.xml.namespace.QName name)
Returns the global attribute defintion with the given name, or null if none.SchemaAttributeGroup
findAttributeGroup(javax.xml.namespace.QName name)
Returns the attribute group defintion with the given name, or null if none.SchemaAttributeGroup.Ref
findAttributeGroupRef(javax.xml.namespace.QName name)
Used for on-demand loading.SchemaGlobalAttribute.Ref
findAttributeRef(javax.xml.namespace.QName name)
Used for on-demand loading.SchemaType
findAttributeType(javax.xml.namespace.QName name)
Returns the attribute type containing the given attribute name, or null if none.SchemaType.Ref
findAttributeTypeRef(javax.xml.namespace.QName name)
Used for on-demand loading.SchemaType
findDocumentType(javax.xml.namespace.QName name)
Returns the document type rooted at the given element name, or null if none.SchemaType.Ref
findDocumentTypeRef(javax.xml.namespace.QName name)
Used for on-demand loading.SchemaGlobalElement
findElement(javax.xml.namespace.QName name)
Returns the global element defintion with the given name, or null if none.SchemaGlobalElement.Ref
findElementRef(javax.xml.namespace.QName name)
Used for on-demand loading.SchemaIdentityConstraint.Ref
findIdentityConstraintRef(javax.xml.namespace.QName name)
Used for on-demand loading.SchemaModelGroup
findModelGroup(javax.xml.namespace.QName name)
Returns the model group defintion with the given name, or null if none.SchemaModelGroup.Ref
findModelGroupRef(javax.xml.namespace.QName name)
Used for on-demand loading.SchemaType
findType(javax.xml.namespace.QName name)
Returns the type with the given name, or null if none.SchemaType.Ref
findTypeRef(javax.xml.namespace.QName name)
Used for on-demand loading.java.io.InputStream
getSourceAsStream(java.lang.String sourceName)
Loads original XSD source as a stream.boolean
isNamespaceDefined(java.lang.String namespace)
True if the typeloader contains any definitions in the given namespace.org.w3c.dom.DOMImplementation
newDomImplementation(XmlOptions options)
Returns a DOMImplementation.XmlObject
newInstance(SchemaType type, XmlOptions options)
Creates an instance of the given type.XmlSaxHandler
newXmlSaxHandler(SchemaType type, XmlOptions options)
Returns an XmlSaxHandler that can parse an instance of the given type.XmlObject
parse(java.io.File file, SchemaType type, XmlOptions options)
Parses an instance of the given type.XmlObject
parse(java.io.InputStream jiois, SchemaType type, XmlOptions options)
Parses an instance of the given type.XmlObject
parse(java.io.Reader jior, SchemaType type, XmlOptions options)
Parses an instance of the given type.XmlObject
parse(java.lang.String xmlText, SchemaType type, XmlOptions options)
Parses an instance of the given type.XmlObject
parse(java.net.URL file, SchemaType type, XmlOptions options)
Parses an instance of the given type.XmlObject
parse(javax.xml.stream.XMLStreamReader xsr, SchemaType type, XmlOptions options)
Parses an instance of the given type.XmlObject
parse(org.w3c.dom.Node node, SchemaType type, XmlOptions options)
Parses an instance of the given type.SchemaType
typeForClassname(java.lang.String classname)
Finds a type for a given fully-qualified XML Bean classnameSchemaType
typeForSignature(java.lang.String signature)
Finds a type for a given signature string
-
-
-
Method Detail
-
findType
SchemaType findType(javax.xml.namespace.QName name)
Returns the type with the given name, or null if none.
-
findDocumentType
SchemaType findDocumentType(javax.xml.namespace.QName name)
Returns the document type rooted at the given element name, or null if none.
-
findAttributeType
SchemaType findAttributeType(javax.xml.namespace.QName name)
Returns the attribute type containing the given attribute name, or null if none.
-
findElement
SchemaGlobalElement findElement(javax.xml.namespace.QName name)
Returns the global element defintion with the given name, or null if none.
-
findAttribute
SchemaGlobalAttribute findAttribute(javax.xml.namespace.QName name)
Returns the global attribute defintion with the given name, or null if none.
-
findModelGroup
SchemaModelGroup findModelGroup(javax.xml.namespace.QName name)
Returns the model group defintion with the given name, or null if none.
-
findAttributeGroup
SchemaAttributeGroup findAttributeGroup(javax.xml.namespace.QName name)
Returns the attribute group defintion with the given name, or null if none.
-
isNamespaceDefined
boolean isNamespaceDefined(java.lang.String namespace)
True if the typeloader contains any definitions in the given namespace.
-
findTypeRef
SchemaType.Ref findTypeRef(javax.xml.namespace.QName name)
Used for on-demand loading.
-
findDocumentTypeRef
SchemaType.Ref findDocumentTypeRef(javax.xml.namespace.QName name)
Used for on-demand loading.
-
findAttributeTypeRef
SchemaType.Ref findAttributeTypeRef(javax.xml.namespace.QName name)
Used for on-demand loading.
-
findElementRef
SchemaGlobalElement.Ref findElementRef(javax.xml.namespace.QName name)
Used for on-demand loading.
-
findAttributeRef
SchemaGlobalAttribute.Ref findAttributeRef(javax.xml.namespace.QName name)
Used for on-demand loading.
-
findModelGroupRef
SchemaModelGroup.Ref findModelGroupRef(javax.xml.namespace.QName name)
Used for on-demand loading.
-
findAttributeGroupRef
SchemaAttributeGroup.Ref findAttributeGroupRef(javax.xml.namespace.QName name)
Used for on-demand loading.
-
findIdentityConstraintRef
SchemaIdentityConstraint.Ref findIdentityConstraintRef(javax.xml.namespace.QName name)
Used for on-demand loading.
-
typeForSignature
SchemaType typeForSignature(java.lang.String signature)
Finds a type for a given signature string
-
typeForClassname
SchemaType typeForClassname(java.lang.String classname)
Finds a type for a given fully-qualified XML Bean classname
-
getSourceAsStream
java.io.InputStream getSourceAsStream(java.lang.String sourceName)
Loads original XSD source as a stream. SeeSchemaComponent.getSourceName()
.
-
compilePath
java.lang.String compilePath(java.lang.String pathExpr, XmlOptions options) throws XmlException
Compiles an XPath- Throws:
XmlException
-
compileQuery
java.lang.String compileQuery(java.lang.String queryExpr, XmlOptions options) throws XmlException
Compiles an XQuery- Throws:
XmlException
-
newInstance
XmlObject newInstance(SchemaType type, XmlOptions options)
Creates an instance of the given type.
-
parse
XmlObject parse(java.lang.String xmlText, SchemaType type, XmlOptions options) throws XmlException
Parses an instance of the given type.- Throws:
XmlException
-
parse
XmlObject parse(java.io.File file, SchemaType type, XmlOptions options) throws XmlException, java.io.IOException
Parses an instance of the given type.- Throws:
XmlException
java.io.IOException
-
parse
XmlObject parse(java.net.URL file, SchemaType type, XmlOptions options) throws XmlException, java.io.IOException
Parses an instance of the given type.- Throws:
XmlException
java.io.IOException
-
parse
XmlObject parse(java.io.InputStream jiois, SchemaType type, XmlOptions options) throws XmlException, java.io.IOException
Parses an instance of the given type.- Throws:
XmlException
java.io.IOException
-
parse
XmlObject parse(javax.xml.stream.XMLStreamReader xsr, SchemaType type, XmlOptions options) throws XmlException
Parses an instance of the given type.- Throws:
XmlException
-
parse
XmlObject parse(java.io.Reader jior, SchemaType type, XmlOptions options) throws XmlException, java.io.IOException
Parses an instance of the given type.- Throws:
XmlException
java.io.IOException
-
parse
XmlObject parse(org.w3c.dom.Node node, SchemaType type, XmlOptions options) throws XmlException
Parses an instance of the given type.- Throws:
XmlException
-
newXmlSaxHandler
XmlSaxHandler newXmlSaxHandler(SchemaType type, XmlOptions options)
Returns an XmlSaxHandler that can parse an instance of the given type.
-
newDomImplementation
org.w3c.dom.DOMImplementation newDomImplementation(XmlOptions options)
Returns a DOMImplementation.
-
-