public class SchemaBuilder
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
(package private) XmlSchemaCollection |
collection |
(package private) org.w3c.dom.Document |
currentDocument |
(package private) XmlSchema |
currentSchema |
private TargetNamespaceValidator |
currentValidator |
(package private) javax.xml.parsers.DocumentBuilderFactory |
docFac |
private ExtensionRegistry |
extReg
The extension registry to be used while building the schema model
|
private static java.util.Set<java.lang.String> |
RESERVED_ATTRIBUTES |
private static java.lang.String[] |
RESERVED_ATTRIBUTES_LIST |
(package private) static java.lang.ThreadLocal<java.util.Map<java.lang.String,java.lang.ref.SoftReference<XmlSchema>>> |
resolvedSchemas |
| Constructor and Description |
|---|
SchemaBuilder(XmlSchemaCollection collection,
TargetNamespaceValidator validator)
Schema builder constructor
|
| Modifier and Type | Method and Description |
|---|---|
(package private) XmlSchema |
build(org.w3c.dom.Document doc,
java.lang.String uri)
build method taking in a document and a validation handler
|
static void |
clearCache()
Remove any entries from the cache for the current thread.
|
private java.lang.String |
getAttribute(org.w3c.dom.Element content,
java.lang.String attrName) |
private XmlSchema |
getCachedSchema(java.lang.String targetNamespace,
java.lang.String schemaLocation,
java.lang.String baseUri)
Return a cached schema if one exists for this thread.
|
private java.util.List<org.w3c.dom.Node> |
getChildren(org.w3c.dom.Element content) |
(package private) XmlSchemaDerivationMethod |
getDerivation(org.w3c.dom.Element el,
java.lang.String attrName) |
(package private) java.lang.String |
getEnumString(org.w3c.dom.Element el,
java.lang.String attrName) |
ExtensionRegistry |
getExtReg() |
(package private) XmlSchemaForm |
getFormDefault(org.w3c.dom.Element el,
java.lang.String attrName) |
(package private) long |
getMaxOccurs(org.w3c.dom.Element el) |
(package private) long |
getMinOccurs(org.w3c.dom.Element el) |
private javax.xml.namespace.QName |
getRefQName(java.lang.String pName,
javax.xml.namespace.NamespaceContext pContext) |
private javax.xml.namespace.QName |
getRefQName(java.lang.String pName,
org.w3c.dom.Node pNode) |
private XmlSchemaAll |
handleAll(XmlSchema schema,
org.w3c.dom.Element allEl,
org.w3c.dom.Element schemaEl) |
(package private) XmlSchemaAnnotation |
handleAnnotation(org.w3c.dom.Element annotEl)
Handles the annotation Traversing if encounter appinfo or documentation add it to annotation collection
|
private XmlSchemaAny |
handleAny(XmlSchema schema,
org.w3c.dom.Element anyEl,
org.w3c.dom.Element schemaEl) |
private XmlSchemaAnyAttribute |
handleAnyAttribute(XmlSchema schema,
org.w3c.dom.Element anyAttrEl,
org.w3c.dom.Element schemaEl) |
(package private) XmlSchemaAppInfo |
handleAppInfo(org.w3c.dom.Element content)
create new XmlSchemaAppinfo and add value gotten from element to this obj
|
private XmlSchemaAttribute |
handleAttribute(XmlSchema schema,
org.w3c.dom.Element attrEl,
org.w3c.dom.Element schemaEl)
Process non-toplevel attributes
|
private XmlSchemaAttribute |
handleAttribute(XmlSchema schema,
org.w3c.dom.Element attrEl,
org.w3c.dom.Element schemaEl,
boolean topLevel)
Process attributes
|
private XmlSchemaAttributeGroup |
handleAttributeGroup(XmlSchema schema,
org.w3c.dom.Element groupEl,
org.w3c.dom.Element schemaEl) |
private XmlSchemaAttributeGroupRef |
handleAttributeGroupRef(XmlSchema schema,
org.w3c.dom.Element attrGroupEl) |
private XmlSchemaChoice |
handleChoice(XmlSchema schema,
org.w3c.dom.Element choiceEl,
org.w3c.dom.Element schemaEl) |
private XmlSchemaComplexContent |
handleComplexContent(XmlSchema schema,
org.w3c.dom.Element complexEl,
org.w3c.dom.Element schemaEl) |
private XmlSchemaComplexContentExtension |
handleComplexContentExtension(XmlSchema schema,
org.w3c.dom.Element extEl,
org.w3c.dom.Element schemaEl) |
private XmlSchemaComplexContentRestriction |
handleComplexContentRestriction(XmlSchema schema,
org.w3c.dom.Element restrictionEl,
org.w3c.dom.Element schemaEl) |
(package private) XmlSchemaComplexType |
handleComplexType(XmlSchema schema,
org.w3c.dom.Element complexEl,
org.w3c.dom.Element schemaEl,
boolean topLevel)
Handle complex types
|
private XmlSchemaIdentityConstraint |
handleConstraint(org.w3c.dom.Element constraintEl,
java.lang.Class<? extends XmlSchemaIdentityConstraint> typeClass) |
(package private) XmlSchemaDocumentation |
handleDocumentation(org.w3c.dom.Element content) |
(package private) XmlSchemaElement |
handleElement(XmlSchema schema,
org.w3c.dom.Element el,
org.w3c.dom.Element schemaEl,
boolean isGlobal)
handle elements
|
private void |
handleElementAnnotation(org.w3c.dom.Element el,
XmlSchemaElement element) |
private boolean |
handleElementForm(org.w3c.dom.Element el,
XmlSchemaElement element,
boolean isQualified) |
private void |
handleElementGlobalType(org.w3c.dom.Element el,
XmlSchemaElement element) |
private void |
handleElementName(boolean isGlobal,
XmlSchemaElement element,
boolean isQualified) |
private XmlSchemaGroup |
handleGroup(XmlSchema schema,
org.w3c.dom.Element groupEl,
org.w3c.dom.Element schemaEl) |
private XmlSchemaGroupRef |
handleGroupRef(XmlSchema schema,
org.w3c.dom.Element groupEl,
org.w3c.dom.Element schemaEl) |
(package private) XmlSchemaImport |
handleImport(XmlSchema schema,
org.w3c.dom.Element importEl,
org.w3c.dom.Element schemaEl)
Handle the import
|
(package private) XmlSchemaInclude |
handleInclude(XmlSchema schema,
org.w3c.dom.Element includeEl,
org.w3c.dom.Element schemaEl)
Handles the include
|
private XmlSchemaNotation |
handleNotation(XmlSchema schema,
org.w3c.dom.Element notationEl) |
private XmlSchemaRedefine |
handleRedefine(XmlSchema schema,
org.w3c.dom.Element redefineEl,
org.w3c.dom.Element schemaEl)
Handle redefine
|
private void |
handleSchemaElementBasics(org.w3c.dom.Element schemaEl,
java.lang.String systemId,
XmlSchemaCollection.SchemaKey schemaKey) |
private void |
handleSchemaElementChild(org.w3c.dom.Element schemaEl,
org.w3c.dom.Element el) |
private XmlSchemaSequence |
handleSequence(XmlSchema schema,
org.w3c.dom.Element sequenceEl,
org.w3c.dom.Element schemaEl) |
private XmlSchemaSimpleContent |
handleSimpleContent(XmlSchema schema,
org.w3c.dom.Element simpleEl,
org.w3c.dom.Element schemaEl) |
private XmlSchemaSimpleContentExtension |
handleSimpleContentExtension(XmlSchema schema,
org.w3c.dom.Element extEl,
org.w3c.dom.Element schemaEl) |
private XmlSchemaSimpleContentRestriction |
handleSimpleContentRestriction(XmlSchema schema,
org.w3c.dom.Element restrictionEl,
org.w3c.dom.Element schemaEl) |
(package private) XmlSchemaSimpleType |
handleSimpleType(XmlSchema schema,
org.w3c.dom.Element simpleEl,
org.w3c.dom.Element schemaEl,
boolean topLevel)
Handles simple types
|
private void |
handleSimpleTypeFinal(org.w3c.dom.Element simpleEl,
XmlSchemaSimpleType simpleType) |
private void |
handleSimpleTypeList(XmlSchema schema,
org.w3c.dom.Element schemaEl,
XmlSchemaSimpleType simpleType,
org.w3c.dom.Element listEl) |
private void |
handleSimpleTypeRestriction(XmlSchema schema,
org.w3c.dom.Element schemaEl,
XmlSchemaSimpleType simpleType,
org.w3c.dom.Element restrictionEl) |
private void |
handleSimpleTypeUnion(XmlSchema schema,
org.w3c.dom.Element schemaEl,
XmlSchemaSimpleType simpleType,
org.w3c.dom.Element unionEl) |
(package private) XmlSchema |
handleXmlSchemaElement(org.w3c.dom.Element schemaEl,
java.lang.String systemId)
handles the schema element
|
static void |
initCache()
Setup the cache to be used by the current thread of execution.
|
private TargetNamespaceValidator |
newIncludeValidator(XmlSchema schema) |
private void |
processExtensibilityComponents(XmlSchemaObject schemaObject,
org.w3c.dom.Element parentElement,
boolean namespaces)
A generic method to process the extra attributes and the the extra elements present within the schema.
|
private void |
putCachedSchema(java.lang.String targetNamespace,
java.lang.String schemaLocation,
java.lang.String baseUri,
XmlSchema readSchema)
Add an XmlSchema to the cache if the current thread has the cache enabled.
|
(package private) XmlSchema |
resolveXmlSchema(java.lang.String targetNamespace,
java.lang.String schemaLocation,
java.lang.String baseUri,
TargetNamespaceValidator validator)
Resolve the schemas
|
(package private) XmlSchema |
resolveXmlSchema(java.lang.String targetNamespace,
java.lang.String schemaLocation,
TargetNamespaceValidator validator)
Resolve the schemas
|
void |
setExtReg(ExtensionRegistry extReg) |
(package private) void |
setNamespaceAttributes(XmlSchema schema,
org.w3c.dom.Element schemaEl) |
static java.lang.ThreadLocal<java.util.Map<java.lang.String,java.lang.ref.SoftReference<XmlSchema>>> resolvedSchemas
private static final java.util.Set<java.lang.String> RESERVED_ATTRIBUTES
private static final java.lang.String[] RESERVED_ATTRIBUTES_LIST
XmlSchemaCollection collection
org.w3c.dom.Document currentDocument
XmlSchema currentSchema
javax.xml.parsers.DocumentBuilderFactory docFac
private final TargetNamespaceValidator currentValidator
private ExtensionRegistry extReg
SchemaBuilder(XmlSchemaCollection collection, TargetNamespaceValidator validator)
collection - validator - public static void clearCache()
public static void initCache()
public ExtensionRegistry getExtReg()
public void setExtReg(ExtensionRegistry extReg)
XmlSchema build(org.w3c.dom.Document doc, java.lang.String uri)
doc - uri - veh - XmlSchemaDerivationMethod getDerivation(org.w3c.dom.Element el, java.lang.String attrName)
java.lang.String getEnumString(org.w3c.dom.Element el,
java.lang.String attrName)
XmlSchemaForm getFormDefault(org.w3c.dom.Element el, java.lang.String attrName)
long getMaxOccurs(org.w3c.dom.Element el)
long getMinOccurs(org.w3c.dom.Element el)
XmlSchemaAnnotation handleAnnotation(org.w3c.dom.Element annotEl)
XmlSchemaAppInfo handleAppInfo(org.w3c.dom.Element content)
content - XmlSchemaComplexType handleComplexType(XmlSchema schema, org.w3c.dom.Element complexEl, org.w3c.dom.Element schemaEl, boolean topLevel)
schema - complexEl - schemaEl - b - XmlSchemaDocumentation handleDocumentation(org.w3c.dom.Element content)
XmlSchemaElement handleElement(XmlSchema schema, org.w3c.dom.Element el, org.w3c.dom.Element schemaEl, boolean isGlobal)
schema - el - schemaEl - isGlobal - XmlSchemaImport handleImport(XmlSchema schema, org.w3c.dom.Element importEl, org.w3c.dom.Element schemaEl)
schema - importEl - schemaEl - XmlSchemaInclude handleInclude(XmlSchema schema, org.w3c.dom.Element includeEl, org.w3c.dom.Element schemaEl)
schema - includeEl - schemaEl - XmlSchemaSimpleType handleSimpleType(XmlSchema schema, org.w3c.dom.Element simpleEl, org.w3c.dom.Element schemaEl, boolean topLevel)
schema - simpleEl - schemaEl - XmlSchema handleXmlSchemaElement(org.w3c.dom.Element schemaEl, java.lang.String systemId)
schemaEl - systemId - XmlSchema resolveXmlSchema(java.lang.String targetNamespace, java.lang.String schemaLocation, java.lang.String baseUri, TargetNamespaceValidator validator)
targetNamespace - schemaLocation - XmlSchema resolveXmlSchema(java.lang.String targetNamespace, java.lang.String schemaLocation, TargetNamespaceValidator validator)
targetNamespace - schemaLocation - void setNamespaceAttributes(XmlSchema schema, org.w3c.dom.Element schemaEl)
private java.lang.String getAttribute(org.w3c.dom.Element content,
java.lang.String attrName)
private XmlSchema getCachedSchema(java.lang.String targetNamespace, java.lang.String schemaLocation, java.lang.String baseUri)
targetNamespace - schemaLocation - baseUri - private java.util.List<org.w3c.dom.Node> getChildren(org.w3c.dom.Element content)
private javax.xml.namespace.QName getRefQName(java.lang.String pName,
javax.xml.namespace.NamespaceContext pContext)
private javax.xml.namespace.QName getRefQName(java.lang.String pName,
org.w3c.dom.Node pNode)
private XmlSchemaAll handleAll(XmlSchema schema, org.w3c.dom.Element allEl, org.w3c.dom.Element schemaEl)
private XmlSchemaAny handleAny(XmlSchema schema, org.w3c.dom.Element anyEl, org.w3c.dom.Element schemaEl)
private XmlSchemaAnyAttribute handleAnyAttribute(XmlSchema schema, org.w3c.dom.Element anyAttrEl, org.w3c.dom.Element schemaEl)
private XmlSchemaAttribute handleAttribute(XmlSchema schema, org.w3c.dom.Element attrEl, org.w3c.dom.Element schemaEl)
schema - attrEl - schemaEl - private XmlSchemaAttribute handleAttribute(XmlSchema schema, org.w3c.dom.Element attrEl, org.w3c.dom.Element schemaEl, boolean topLevel)
schema - attrEl - schemaEl - topLevel - private XmlSchemaAttributeGroup handleAttributeGroup(XmlSchema schema, org.w3c.dom.Element groupEl, org.w3c.dom.Element schemaEl)
private XmlSchemaAttributeGroupRef handleAttributeGroupRef(XmlSchema schema, org.w3c.dom.Element attrGroupEl)
private XmlSchemaChoice handleChoice(XmlSchema schema, org.w3c.dom.Element choiceEl, org.w3c.dom.Element schemaEl)
private XmlSchemaComplexContent handleComplexContent(XmlSchema schema, org.w3c.dom.Element complexEl, org.w3c.dom.Element schemaEl)
private XmlSchemaComplexContentExtension handleComplexContentExtension(XmlSchema schema, org.w3c.dom.Element extEl, org.w3c.dom.Element schemaEl)
private XmlSchemaComplexContentRestriction handleComplexContentRestriction(XmlSchema schema, org.w3c.dom.Element restrictionEl, org.w3c.dom.Element schemaEl)
private XmlSchemaIdentityConstraint handleConstraint(org.w3c.dom.Element constraintEl, java.lang.Class<? extends XmlSchemaIdentityConstraint> typeClass)
private void handleElementAnnotation(org.w3c.dom.Element el,
XmlSchemaElement element)
private boolean handleElementForm(org.w3c.dom.Element el,
XmlSchemaElement element,
boolean isQualified)
private void handleElementGlobalType(org.w3c.dom.Element el,
XmlSchemaElement element)
private void handleElementName(boolean isGlobal,
XmlSchemaElement element,
boolean isQualified)
private XmlSchemaGroup handleGroup(XmlSchema schema, org.w3c.dom.Element groupEl, org.w3c.dom.Element schemaEl)
private XmlSchemaGroupRef handleGroupRef(XmlSchema schema, org.w3c.dom.Element groupEl, org.w3c.dom.Element schemaEl)
private XmlSchemaNotation handleNotation(XmlSchema schema, org.w3c.dom.Element notationEl)
private XmlSchemaRedefine handleRedefine(XmlSchema schema, org.w3c.dom.Element redefineEl, org.w3c.dom.Element schemaEl)
schema - redefineEl - schemaEl - private void handleSchemaElementBasics(org.w3c.dom.Element schemaEl,
java.lang.String systemId,
XmlSchemaCollection.SchemaKey schemaKey)
private void handleSchemaElementChild(org.w3c.dom.Element schemaEl,
org.w3c.dom.Element el)
private XmlSchemaSequence handleSequence(XmlSchema schema, org.w3c.dom.Element sequenceEl, org.w3c.dom.Element schemaEl)
private XmlSchemaSimpleContent handleSimpleContent(XmlSchema schema, org.w3c.dom.Element simpleEl, org.w3c.dom.Element schemaEl)
private XmlSchemaSimpleContentExtension handleSimpleContentExtension(XmlSchema schema, org.w3c.dom.Element extEl, org.w3c.dom.Element schemaEl)
private XmlSchemaSimpleContentRestriction handleSimpleContentRestriction(XmlSchema schema, org.w3c.dom.Element restrictionEl, org.w3c.dom.Element schemaEl)
private void handleSimpleTypeFinal(org.w3c.dom.Element simpleEl,
XmlSchemaSimpleType simpleType)
private void handleSimpleTypeList(XmlSchema schema, org.w3c.dom.Element schemaEl, XmlSchemaSimpleType simpleType, org.w3c.dom.Element listEl)
private void handleSimpleTypeRestriction(XmlSchema schema, org.w3c.dom.Element schemaEl, XmlSchemaSimpleType simpleType, org.w3c.dom.Element restrictionEl)
private void handleSimpleTypeUnion(XmlSchema schema, org.w3c.dom.Element schemaEl, XmlSchemaSimpleType simpleType, org.w3c.dom.Element unionEl)
private TargetNamespaceValidator newIncludeValidator(XmlSchema schema)
private void processExtensibilityComponents(XmlSchemaObject schemaObject, org.w3c.dom.Element parentElement, boolean namespaces)
schemaObject - parentElement - private void putCachedSchema(java.lang.String targetNamespace,
java.lang.String schemaLocation,
java.lang.String baseUri,
XmlSchema readSchema)
targetNamespace - schemaLocation - baseUri - This parameter is the value put under the key (if the cache is enabled)readSchema -