Package com.saxonica.ee.schema.sdoc
Class XSDSchema
- java.lang.Object
-
- net.sf.saxon.tree.linked.NodeImpl
-
- net.sf.saxon.tree.linked.ParentNodeImpl
-
- net.sf.saxon.tree.linked.ElementImpl
-
- com.saxonica.ee.schema.sdoc.SchemaElement
-
- com.saxonica.ee.schema.sdoc.XSDSchema
-
- All Implemented Interfaces:
javax.xml.transform.Source
,javax.xml.transform.SourceLocator
,ActiveSource
,GroundedValue
,Item
,MutableNodeInfo
,NamespaceResolver
,NodeInfo
,Sequence
,Location
,SteppingNode
,SiblingCountingNode
,org.xml.sax.Locator
public class XSDSchema extends SchemaElement
An xs:schema element in an XML Schema document
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.saxonica.ee.schema.sdoc.SchemaElement
SchemaElement.XPathStaticContext
-
-
Field Summary
-
Fields inherited from class com.saxonica.ee.schema.sdoc.SchemaElement
NAMESPACE_ANY, NAMESPACE_LOCAL, NAMESPACE_OTHER, NAMESPACE_TARGET, REQUIRE_NULL_NS, REQUIRE_TARGET_NS, USE_DEFAULT_NS, USE_DEFAULT_NS_WITHOUT_IMPORT
-
Fields inherited from class net.sf.saxon.tree.linked.NodeImpl
NODE_LETTER
-
-
Constructor Summary
Constructors Constructor Description XSDSchema()
Create an XSDSchema object, representing the xs:schema element in a schema document
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGlobalParam(GlobalParam param)
Declare a global parameter for XPath expressions in this schema document (Saxon extension)boolean
defaultOpenContentAppliesToEmpty()
Ask if the default open content wildcard applies to types that would otherwise have an EMPTY content modeljava.util.Set<java.lang.String>
getAllowedExtensions()
Get the set of extensions allowed in this schema documentjava.lang.String
getAttributeFormDefault()
Returns the attributeFormDefault property of this Schema.int
getBlockDefault()
Returns the default BlockList for this Schema.AttributeGroupReference
getDefaultAttributeGroupReference()
Get a reference to the default attribute groupjava.lang.String
getDefaultOpenContentMode()
Get the default open content mode, as a string (interleave or suffix)Wildcard
getDefaultOpenContentWildcard()
Get the default open content wildcard, if anyjava.lang.String
getElementFormDefault()
Returns the elementFormDefault property of this Schema.int
getErrorCount()
Get the number of errors detected in this schema documentExecutable
getExecutable()
Get the Executable corresponding to this schema document.int
getFinalDefault()
Returns the default value of "final" for this Schema.GlobalParam
getGlobalParam(StructuredQName name)
Get the GlobalParam object representing a named parameter (Saxon extension)java.util.Collection<GlobalParam>
getGlobalParams()
Return the set of global parameters defined in this schema documentSingleNamespaceSchema
getSchema()
Get the PreparedSchema to which schema components are being addedSchemaCompiler
getSchemaCompiler()
Get the SchemaCompiler in usejava.lang.String
getTargetNamespace()
Get the target namespace of this schema document.java.lang.String
getXPathDefaultNamespace()
Get the value of the defaultXPathDefaultNamespace attribute defined on this elementvoid
incrementErrorCount()
Increment the number of errors detected in this schema documentboolean
isChameleon()
Determine if this is a chameleon schema document, that is, one with no targetNamespace of its own, whose effective target namespace (and for many purposes, default namespace) are set to the targetNamespace of the referring schema document.protected boolean
isFinalState(int state)
For elements whose content model is parsed using a finite state machine, test whether a given state is a final state.boolean
isImportedNamespace(java.lang.String uri)
Determine whether a given URI is that of a namespace that has been imported into this schema document.void
postValidate(SchemaCompiler compiler)
Process child elements after validationprotected void
prepareAttributes()
Validate and process the attributes on this element in the schema documentvoid
setAttributeFormDefault(java.lang.String attributeFormDefault)
Sets the attributeFormDefault property of this Schema.void
setBlockDefault(int value)
Sets the default Block values for this Schema.void
setDefaultOpenContent(Wildcard wildcard, java.lang.String mode, boolean appliesToEmpty)
Set the open content wildcard and modevoid
setElementFormDefault(java.lang.String elementFormDefault)
Sets the elementFormDefault property of this Schema.void
setFinalDefault(int value)
Set the default "final" list for this Schema.void
setReferrer(SchemaElement referrer)
Set the xs:include, xs:import, or xs:redefine element that caused this schema document to be loadedvoid
setSchema(SingleNamespaceSchema schema)
Set the SingleNamespaceSchema to which schema components are being addedvoid
setSchemaCompiler(SchemaCompiler manager)
Set the SchemaCompiler in usevoid
validate(SchemaCompiler compiler)
Validate this schema element, checking all document-level constraintsprotected void
validateChildren(SchemaCompiler compiler)
Validate the children of this node, recursively.-
Methods inherited from class com.saxonica.ee.schema.sdoc.SchemaElement
allocateAnonymousTypeCode, allowAttributes, checkContentModel, checkLocalTargetNamespace, checkMutuallyExclusiveAttributes, checkOnlyChildIsAnnotation, checkPermittedType, duplicate, duplicateElement, error, error, getComponentName, getContainingComplexType, getContainingSimpleType, getFingerprint, getSchemaNodeFactory, getXSDSchema, illegalElement, indefiniteArticle, invalidAttributeValue, isTopLevel, makeNamespaceContext, missingAttribute, missingChildElement, mustBeFirstElement, mustPrecede, mutuallyExclusive, mutuallyExclusiveAttributes, mutuallyExclusiveElementAndAttribute, parseBooleanAttribute, parseFinalOrBlock, processAllAttributes, processAllowedNamespaces, processDisallowedNamespaces, processDisallowedQNames, processId, processMaxOccurs, processMinOccurs, requireAttribute, setSchemaNodeFactory, validateSubtree, warning
-
Methods inherited from class net.sf.saxon.tree.linked.ElementImpl
addAttribute, addNamespace, addNamespace, attributes, checkNotNamespaceSensitiveElement, copy, delete, fixupInsertedNamespaces, generateId, getAllNamespaces, getAttributeValue, getBaseURI, getColumnNumber, getDeclaredNamespaces, getLineNumber, getNodeKind, getNodeName, getRoot, getSchemaType, getSystemId, getURIForPrefix, initialise, isId, isIdref, isIdRefNode, isInScopeNamespace, isNilled, iteratePrefixes, removeAttribute, removeNamespace, removeTypeAnnotation, rename, replaceStringValue, setAttributeInfo, setAttributes, setLocation, setNamespaceMap, setNilled, setNodeName, setSystemId, setTypeAnnotation
-
Methods inherited from class net.sf.saxon.tree.linked.ParentNodeImpl
addChild, compact, getFirstChild, getLastChild, getNthChild, getNumberOfChildren, getRawSequenceNumber, getSequenceNumber, getUnicodeStringValue, hasChildNodes, insertChildren, insertChildrenAt, iterateChildren, removeChild, replaceChildrenAt, setChildren, setRawSequenceNumber
-
Methods inherited from class net.sf.saxon.tree.linked.NodeImpl
atomize, compareOrder, effectiveBooleanValue, equals, getConfiguration, getDisplayName, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPhysicalRoot, getPrefix, getPreviousInDocument, getPreviousSibling, getRawParent, getSiblingPosition, getSuccessorElement, getTreeInfo, getURI, hasFingerprint, hashCode, head, insertSiblings, isDeleted, iterateAxis, iterateAxis, newBuilder, replace, saveLocation, setRawParent, setSiblingPosition
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, getStringValue, itemAt, iterate, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.om.NodeInfo
asActiveSource, children, children, deliver, getGenre, getPublicId, isSameNodeInfo, isStreamed, toShortString
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Method Detail
-
getSchema
public SingleNamespaceSchema getSchema()
Get the PreparedSchema to which schema components are being added- Overrides:
getSchema
in classSchemaElement
- Returns:
- the PreparedSchema containing the compiled schema components
-
getExecutable
public Executable getExecutable()
Get the Executable corresponding to this schema document. This is a container for the XPath expressions it contains.- Returns:
- the Executable for XPath expressions
-
getAllowedExtensions
public java.util.Set<java.lang.String> getAllowedExtensions()
Get the set of extensions allowed in this schema document- Returns:
- the set of allowed extensions (from the saxon:extensions attribute)
-
setSchema
public void setSchema(SingleNamespaceSchema schema)
Set the SingleNamespaceSchema to which schema components are being added- Parameters:
schema
- the SingleNamespaceSchema containing the compiled schema components
-
setSchemaCompiler
public void setSchemaCompiler(SchemaCompiler manager)
Set the SchemaCompiler in use- Parameters:
manager
- the schema compiler
-
getSchemaCompiler
public SchemaCompiler getSchemaCompiler()
Get the SchemaCompiler in use- Returns:
- the schema compiler
-
setReferrer
public void setReferrer(SchemaElement referrer)
Set the xs:include, xs:import, or xs:redefine element that caused this schema document to be loaded- Parameters:
referrer
- the referring xs:include, xs:import, or xs:redefine element
-
isChameleon
public boolean isChameleon()
Determine if this is a chameleon schema document, that is, one with no targetNamespace of its own, whose effective target namespace (and for many purposes, default namespace) are set to the targetNamespace of the referring schema document.- Returns:
- true if this document is a chameleon
-
prepareAttributes
protected void prepareAttributes() throws SchemaException
Validate and process the attributes on this element in the schema document- Specified by:
prepareAttributes
in classSchemaElement
- Throws:
SchemaException
- if any errors are found in the attributes
-
isImportedNamespace
public boolean isImportedNamespace(java.lang.String uri)
Determine whether a given URI is that of a namespace that has been imported into this schema document.- Parameters:
uri
- the namespace URI ("" for the null namespace)- Returns:
- true if the namespace has been imported, false otherwise
-
validate
public void validate(SchemaCompiler compiler) throws SchemaException
Validate this schema element, checking all document-level constraints- Overrides:
validate
in classSchemaElement
- Parameters:
compiler
- used for reporting errors- Throws:
SchemaException
- if any XML representation constraints are violated
-
validateChildren
protected void validateChildren(SchemaCompiler compiler) throws SchemaException
Validate the children of this node, recursively.- Overrides:
validateChildren
in classSchemaElement
- Parameters:
compiler
- used for error reporting- Throws:
SchemaException
- if the subtree is not valid
-
isFinalState
protected boolean isFinalState(int state)
Description copied from class:SchemaElement
For elements whose content model is parsed using a finite state machine, test whether a given state is a final state. The default implementation of this method is never used; it exists for the benefit of subclasses that do not use this mechanism- Overrides:
isFinalState
in classSchemaElement
- Parameters:
state
- the state to be tested- Returns:
- true if the given state is a final state
-
postValidate
public void postValidate(SchemaCompiler compiler) throws SchemaException
Process child elements after validation- Overrides:
postValidate
in classSchemaElement
- Parameters:
compiler
- used for reporting errors- Throws:
SchemaException
- if errors are found
-
getTargetNamespace
public java.lang.String getTargetNamespace()
Get the target namespace of this schema document.- Returns:
- "" for the no-namespace case
-
getAttributeFormDefault
public java.lang.String getAttributeFormDefault()
Returns the attributeFormDefault property of this Schema.- Returns:
- the attributeFormDefault property of this Schema, or null if no default Form was set. If no default Form has been set, the user should assume Form.Unqualified. The value is returned as a string, "qualified" or "unqualified".
-
getBlockDefault
public int getBlockDefault()
Returns the default BlockList for this Schema.- Returns:
- the default BlockList for this Schema, as an integer with bit-significant fields
-
getElementFormDefault
public java.lang.String getElementFormDefault()
Returns the elementFormDefault property of this Schema.- Returns:
- the elementFormDefault property of this Schema. The value is returned as a string ("qualified" or "unqualified"), or null if no default Form was set. If no default Form has been set, the user should assume "unqualified".
-
getFinalDefault
public int getFinalDefault()
Returns the default value of "final" for this Schema.- Returns:
- final the default value of "final" for this Schema.
-
getDefaultOpenContentWildcard
public Wildcard getDefaultOpenContentWildcard()
Get the default open content wildcard, if any- Returns:
- the default open content wildcard if there is one, otherwise null
-
getDefaultOpenContentMode
public java.lang.String getDefaultOpenContentMode()
Get the default open content mode, as a string (interleave or suffix)- Returns:
- the default open content mode, or null if none is defined
-
defaultOpenContentAppliesToEmpty
public boolean defaultOpenContentAppliesToEmpty()
Ask if the default open content wildcard applies to types that would otherwise have an EMPTY content model- Returns:
- true if open content applies by default to empty types
-
setAttributeFormDefault
public void setAttributeFormDefault(java.lang.String attributeFormDefault)
Sets the attributeFormDefault property of this Schema.- Parameters:
attributeFormDefault
- the Form value of the attributeFormDefault property for this Schema, as a string, "qualified" or "unqualified". The caller is responsible for validating the value.
-
setBlockDefault
public void setBlockDefault(int value)
Sets the default Block values for this Schema.- Parameters:
value
- the default Block values to set for this Schema, as a bit-significant integer.
-
setElementFormDefault
public void setElementFormDefault(java.lang.String elementFormDefault)
Sets the elementFormDefault property of this Schema.- Parameters:
elementFormDefault
- the Form value of the elementFormDefault property for this Schema.
-
setFinalDefault
public void setFinalDefault(int value)
Set the default "final" list for this Schema.- Parameters:
value
- the default final values to set for this Schema, as a bit-significant integer
-
setDefaultOpenContent
public void setDefaultOpenContent(Wildcard wildcard, java.lang.String mode, boolean appliesToEmpty)
Set the open content wildcard and mode- Parameters:
wildcard
- the default open content wildcardmode
- the default open content mode, as a stringappliesToEmpty
- true if the default open content wildcard applies to types that would otherwise have variety empty
-
getXPathDefaultNamespace
public java.lang.String getXPathDefaultNamespace()
Get the value of the defaultXPathDefaultNamespace attribute defined on this element- Returns:
- the value of the defaultXPathDefaultNamespace attribute, or "##local" if no value has been defined for the attribute
-
getDefaultAttributeGroupReference
public AttributeGroupReference getDefaultAttributeGroupReference()
Get a reference to the default attribute group- Returns:
- a reference to the default attribute group if there is one, or null otherwise
-
getErrorCount
public int getErrorCount()
Get the number of errors detected in this schema document- Returns:
- the number of errors detected
-
incrementErrorCount
public void incrementErrorCount()
Increment the number of errors detected in this schema document
-
addGlobalParam
public void addGlobalParam(GlobalParam param) throws SchemaException
Declare a global parameter for XPath expressions in this schema document (Saxon extension)- Parameters:
param
- the details of the parameter- Throws:
SchemaException
- if the variable name is a duplicate
-
getGlobalParam
public GlobalParam getGlobalParam(StructuredQName name)
Get the GlobalParam object representing a named parameter (Saxon extension)- Parameters:
name
- the parameter name- Returns:
- the GlobalParam object if a parameter with this name exists, else null
-
getGlobalParams
public java.util.Collection<GlobalParam> getGlobalParams()
Return the set of global parameters defined in this schema document- Returns:
- the set of global parameters
-
-