Represents a searchable set of XML Schema component definitions.
SchemaTypeLoader is somewhat analogous to ClassLoader,
because it is responsible for finding SchemaComponent 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, see SchemaTypeSystem.) 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 (see Thread.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
call SchemaTypeLoader.parse(String, SchemaType, 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(XmlObject[]), or by assembling other SchemaTypeLoaders
or SchemaTypeSystems on a path using XmlBeans.typeLoaderUnion(SchemaTypeLoader[]).
Related Topics
XmlBeans.loadXsd(XmlObject[])
XmlBeans.getContextTypeLoader()
XmlBeans.typeLoaderUnion(SchemaTypeLoader[])
SchemaTypeSystem
SchemaTypeSystem
Method Summary |
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public | |
public |
|
public |
|
public boolean |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
public |
|
Method Detail |
publicCompiles an XPathStringcompilePath(StringpathExpr,XmlOptionsoptions)
throwsXmlException
XmlException
publicCompiles an XQueryStringcompileQuery(StringqueryExpr,XmlOptionsoptions)
throwsXmlException
XmlException
publicReturns the global attribute defintion with the given name, or null if none.SchemaGlobalAttributefindAttribute(QNamename)
publicReturns the attribute group defintion with the given name, or null if none.SchemaAttributeGroupfindAttributeGroup(QNamename)
publicUsed for on-demand loading.SchemaAttributeGroup.ReffindAttributeGroupRef(QNamename)
publicUsed for on-demand loading.SchemaGlobalAttribute.ReffindAttributeRef(QNamename)
publicReturns the attribute type containing the given attribute name, or null if none.SchemaTypefindAttributeType(QNamename)
publicUsed for on-demand loading.SchemaType.ReffindAttributeTypeRef(QNamename)
publicReturns the document type rooted at the given element name, or null if none.SchemaTypefindDocumentType(QNamename)
publicUsed for on-demand loading.SchemaType.ReffindDocumentTypeRef(QNamename)
publicReturns the global element defintion with the given name, or null if none.SchemaGlobalElementfindElement(QNamename)
publicUsed for on-demand loading.SchemaGlobalElement.ReffindElementRef(QNamename)
publicUsed for on-demand loading.SchemaIdentityConstraint.ReffindIdentityConstraintRef(QNamename)
publicReturns the model group defintion with the given name, or null if none.SchemaModelGroupfindModelGroup(QNamename)
publicUsed for on-demand loading.SchemaModelGroup.ReffindModelGroupRef(QNamename)
publicReturns the type with the given name, or null if none.SchemaTypefindType(QNamename)
publicUsed for on-demand loading.SchemaType.ReffindTypeRef(QNamename)
publicLoads original XSD source as a stream. SeeInputStreamgetSourceAsStream(StringsourceName)
SchemaType.getSourceName().
public boolean isNamespaceDefined(String namespace)
True if the typeloader contains any definitions in the given namespace.
publicCreates an instance of the given type.XmlObjectnewInstance(SchemaTypetype,XmlOptionsoptions)
DEPRECATED Superceded by JSR 173
publicReturns a validating XMLInputStream that will throw an exception if the XML is not validXMLInputStreamnewValidatingXMLInputStream(XMLInputStreamxis,SchemaTypetype,XmlOptionsoptions)
throwsXmlException,XMLStreamException
XmlException
XMLStreamException
publicReturns an XmlSaxHandler that can parse an instance of the given type.XmlSaxHandlernewXmlSaxHandler(SchemaTypetype,XmlOptionsoptions)
publicParses an instance of the given type.XmlObjectparse(StringxmlText,SchemaTypetype,XmlOptionsoptions)
throwsXmlException
XmlException
publicParses an instance of the given type.XmlObjectparse(Filefile,SchemaTypetype,XmlOptionsoptions)
throwsXmlException,IOException
XmlException
IOException
publicParses an instance of the given type.XmlObjectparse(URLfile,SchemaTypetype,XmlOptionsoptions)
throwsXmlException,IOException
XmlException
IOException
publicParses an instance of the given type.XmlObjectparse(InputStreamjiois,SchemaTypetype,XmlOptionsoptions)
throwsXmlException,IOException
XmlException
IOException
publicParses an instance of the given type.XmlObjectparse(Readerjior,SchemaTypetype,XmlOptionsoptions)
throwsXmlException,IOException
XmlException
IOException
publicParses an instance of the given type.XmlObjectparse(Nodenode,SchemaTypetype,XmlOptionsoptions)
throwsXmlException
XmlException
DEPRECATED Superceded by JSR 173
publicParses an instance of the given type.XmlObjectparse(XMLInputStreamxis,SchemaTypetype,XmlOptionsoptions)
throwsXmlException,XMLStreamException
XmlException
XMLStreamException
publicFinds a type for a given fully-qualified XML Bean classnameSchemaTypetypeForClassname(Stringclassname)
publicFinds a type for a given signature stringSchemaTypetypeForSignature(Stringsignature)