public final class XmlSchemaCollection
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
XmlSchemaCollection.SchemaKey
Key that identifies a schema in a collection, composed of a targetNamespace and a system ID.
|
| Modifier and Type | Field and Description |
|---|---|
(package private) java.lang.String |
baseUri
base URI is used as the base for loading the imports
|
private ExtensionRegistry |
extReg |
private java.util.Map<java.lang.String,XmlSchema> |
knownNamespaceMap
This map contains a list of Schema objects keyed in by their namespaces.
|
private NamespacePrefixList |
namespaceContext
In-scope namespaces for XML processing
|
private URIResolver |
schemaResolver
Resolver to find included schemas.
|
private java.util.Map<XmlSchemaCollection.SchemaKey,XmlSchema> |
schemas
Map of included schemas.
|
(package private) java.util.Stack<XmlSchemaCollection.SchemaKey> |
stack
stack to track imports (to prevent recursion)
|
(package private) java.util.Map<javax.xml.namespace.QName,java.util.List<TypeReceiver>> |
unresolvedTypes |
(package private) XmlSchema |
xsd |
| Constructor and Description |
|---|
XmlSchemaCollection()
Creates new XmlSchemaCollection
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
addSchema(XmlSchemaCollection.SchemaKey pKey,
XmlSchema pSchema) |
private void |
addSimpleType(XmlSchema schema,
java.lang.String typeName) |
(package private) void |
addUnresolvedType(javax.xml.namespace.QName type,
TypeReceiver receiver) |
boolean |
check(XmlSchemaCollection.SchemaKey pKey)
Return an indication of whether a particular schema is in the working stack of schemas.
|
(package private) boolean |
containsSchema(XmlSchemaCollection.SchemaKey pKey) |
XmlSchemaAttribute |
getAttributeByQName(javax.xml.namespace.QName schemaAttributeName)
Find a global attribute by QName in this collection of schemas.
|
XmlSchemaAttributeGroup |
getAttributeGroupByQName(javax.xml.namespace.QName name) |
XmlSchemaElement |
getElementByQName(javax.xml.namespace.QName qname)
Retrieve a global element from the schema collection.
|
ExtensionRegistry |
getExtReg() |
XmlSchemaGroup |
getGroupByQName(javax.xml.namespace.QName name) |
java.util.Map<java.lang.String,XmlSchema> |
getKnownNamespaceMap()
get the namespace map
|
(package private) XmlSchema |
getKnownSchema(java.lang.String namespace)
gets a schema from the external namespace map
|
NamespacePrefixList |
getNamespaceContext()
Retrieve the namespace context.
|
XmlSchemaNotation |
getNotationByQName(javax.xml.namespace.QName name) |
(package private) XmlSchema |
getSchema(XmlSchemaCollection.SchemaKey pKey)
Get a schema given a SchemaKey
|
URIResolver |
getSchemaResolver()
Retrieve the custom URI resolver, if any.
|
private java.lang.String |
getSystemProperty(java.lang.String s) |
XmlSchemaType |
getTypeByQName(javax.xml.namespace.QName schemaTypeName)
Retrieve a global type from the schema collection.
|
XmlSchema[] |
getXmlSchema(java.lang.String systemId)
Retrieve a set containing the XmlSchema instances with the given system ID.
|
XmlSchema[] |
getXmlSchemas()
Returns an array of all the XmlSchemas in this collection.
|
void |
init()
This section should comply to the XMLSchema specification; see
http://www.w3.org/TR/2004/PER-xmlschema-2-20040318/datatypes.html#built-in-datatypes.
|
private org.w3c.dom.Document |
parseDoPriv(org.xml.sax.InputSource inputSource,
javax.xml.parsers.DocumentBuilder builder,
org.w3c.dom.Document doc) |
void |
pop()
Pop the stack of schemas.
|
void |
push(XmlSchemaCollection.SchemaKey pKey)
Push a schema onto the stack of schemas.
|
XmlSchema |
read(org.w3c.dom.Document doc)
Read an XML schema into the collection from a DOM document.
|
XmlSchema |
read(org.w3c.dom.Document doc,
java.lang.String systemId)
Read an XML Schema from a complete XSD XML DOM Document into this collection.
|
XmlSchema |
read(org.w3c.dom.Document doc,
java.lang.String systemId,
TargetNamespaceValidator validator)
Read an XML Schema from a complete XSD XML DOM Document into this collection.
|
XmlSchema |
read(org.w3c.dom.Element elem)
Read an XML Schema into the collection from a DOM element.
|
XmlSchema |
read(org.w3c.dom.Element elem,
java.lang.String systemId)
Read a schema from a DOM tree into the collection.
|
XmlSchema |
read(org.xml.sax.InputSource inputSource)
Read an XML schema into the collection from a SAX InputSource.
|
(package private) XmlSchema |
read(org.xml.sax.InputSource inputSource,
TargetNamespaceValidator namespaceValidator) |
XmlSchema |
read(java.io.Reader r) |
XmlSchema |
read(javax.xml.transform.Source source)
Read an XML schema into the collection from a TRaX source.
|
(package private) void |
resolveType(javax.xml.namespace.QName typeName,
XmlSchemaType type) |
XmlSchema |
schemaForNamespace(java.lang.String uri)
Return the schema from this collection for a particular targetNamespace.
|
void |
setBaseUri(java.lang.String baseUri)
Set the base URI.
|
private void |
setDerivationByList(XmlSchema xsd,
javax.xml.namespace.QName child,
javax.xml.namespace.QName parent) |
private void |
setDerivationByRestriction(XmlSchema xsd,
javax.xml.namespace.QName child,
javax.xml.namespace.QName parent) |
private void |
setDerivationByRestriction(XmlSchema xsd,
javax.xml.namespace.QName child,
javax.xml.namespace.QName parent,
XmlSchemaFacet[] facets) |
void |
setExtReg(ExtensionRegistry extReg) |
void |
setKnownNamespaceMap(java.util.Map<java.lang.String,XmlSchema> knownNamespaceMap)
sets the known namespace map
|
void |
setNamespaceContext(NamespacePrefixList namespaceContext)
Set the namespace context for this collection, which controls the assignment of namespace prefixes to
namespaces.
|
void |
setSchemaResolver(URIResolver schemaResolver)
Register a custom URI resolver
|
private void |
setupBuiltinDatatypeHierarchy(XmlSchema xsd) |
java.lang.String |
toString() |
java.lang.String baseUri
java.util.Stack<XmlSchemaCollection.SchemaKey> stack
java.util.Map<javax.xml.namespace.QName,java.util.List<TypeReceiver>> unresolvedTypes
XmlSchema xsd
private ExtensionRegistry extReg
private java.util.Map<java.lang.String,XmlSchema> knownNamespaceMap
private NamespacePrefixList namespaceContext
private URIResolver schemaResolver
private java.util.Map<XmlSchemaCollection.SchemaKey,XmlSchema> schemas
public boolean check(XmlSchemaCollection.SchemaKey pKey)
pKey - schema keypublic ExtensionRegistry getExtReg()
public java.util.Map<java.lang.String,XmlSchema> getKnownNamespaceMap()
public NamespacePrefixList getNamespaceContext()
public URIResolver getSchemaResolver()
public XmlSchemaType getTypeByQName(javax.xml.namespace.QName schemaTypeName)
schemaTypeName - the QName of the type.public XmlSchema[] getXmlSchema(java.lang.String systemId)
systemId - the system id for this schemapublic XmlSchema[] getXmlSchemas()
public void init()
private java.lang.String getSystemProperty(java.lang.String s)
private void setupBuiltinDatatypeHierarchy(XmlSchema xsd)
private void setDerivationByRestriction(XmlSchema xsd, javax.xml.namespace.QName child, javax.xml.namespace.QName parent)
private void setDerivationByRestriction(XmlSchema xsd, javax.xml.namespace.QName child, javax.xml.namespace.QName parent, XmlSchemaFacet[] facets)
private void setDerivationByList(XmlSchema xsd, javax.xml.namespace.QName child, javax.xml.namespace.QName parent)
public void pop()
public void push(XmlSchemaCollection.SchemaKey pKey)
pKey - the schema key.public XmlSchema read(org.w3c.dom.Document doc, java.lang.String systemId)
doc - The schema document.systemId - System ID for this schema.public XmlSchema read(org.w3c.dom.Document doc, java.lang.String systemId, TargetNamespaceValidator validator)
doc - Source document.systemId - System id.validator - object that is called back to check validity of the target namespace.public XmlSchema read(org.w3c.dom.Document doc)
doc - the XSD document.public XmlSchema read(org.w3c.dom.Element elem)
elem - the DOM element for the schema.public XmlSchema read(org.w3c.dom.Element elem, java.lang.String systemId)
elem - xs:schema DOM element.systemId - System id.public XmlSchema read(org.xml.sax.InputSource inputSource)
inputSource - the XSD document.public XmlSchema read(java.io.Reader r)
public XmlSchema read(javax.xml.transform.Source source)
source - the XSD document.public XmlSchema schemaForNamespace(java.lang.String uri)
uri - target namespace URI.public void setBaseUri(java.lang.String baseUri)
baseUri - baseUri for this collection.public void setExtReg(ExtensionRegistry extReg)
public void setKnownNamespaceMap(java.util.Map<java.lang.String,XmlSchema> knownNamespaceMap)
knownNamespaceMap - a map of previously known XMLSchema objects keyed by their namespace (String)public void setNamespaceContext(NamespacePrefixList namespaceContext)
namespaceContext - the context.public void setSchemaResolver(URIResolver schemaResolver)
schemaResolver - resolverpublic java.lang.String toString()
toString in class java.lang.Objectvoid addSchema(XmlSchemaCollection.SchemaKey pKey, XmlSchema pSchema)
void addUnresolvedType(javax.xml.namespace.QName type,
TypeReceiver receiver)
boolean containsSchema(XmlSchemaCollection.SchemaKey pKey)
XmlSchema getKnownSchema(java.lang.String namespace)
namespace - XmlSchema getSchema(XmlSchemaCollection.SchemaKey pKey)
pKey - XmlSchema read(org.xml.sax.InputSource inputSource, TargetNamespaceValidator namespaceValidator)
void resolveType(javax.xml.namespace.QName typeName,
XmlSchemaType type)
private void addSimpleType(XmlSchema schema, java.lang.String typeName)
private org.w3c.dom.Document parseDoPriv(org.xml.sax.InputSource inputSource,
javax.xml.parsers.DocumentBuilder builder,
org.w3c.dom.Document doc)
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOExceptionorg.xml.sax.SAXExceptionpublic XmlSchemaAttribute getAttributeByQName(javax.xml.namespace.QName schemaAttributeName)
schemaAttributeName - the name of the attribute.public XmlSchemaElement getElementByQName(javax.xml.namespace.QName qname)
qname - the element QName.public XmlSchemaAttributeGroup getAttributeGroupByQName(javax.xml.namespace.QName name)
public XmlSchemaGroup getGroupByQName(javax.xml.namespace.QName name)
public XmlSchemaNotation getNotationByQName(javax.xml.namespace.QName name)