Class XSDSchema

All Implemented Interfaces:
Source, SourceLocator, ActiveSource, GroundedValue, Item, MutableNodeInfo, NamespaceResolver, NodeInfo, Sequence, Location, SteppingNode, SiblingCountingNode, Locator

public class XSDSchema extends SchemaElement
An xs:schema element in an XML Schema document
  • Constructor Details

    • XSDSchema

      public XSDSchema()
      Create an XSDSchema object, representing the xs:schema element in a schema document
  • Method Details

    • getSchema

      public SingleNamespaceSchema getSchema()
      Get the PreparedSchema to which schema components are being added
      Overrides:
      getSchema in class SchemaElement
      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 Set<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 class SchemaElement
      Throws:
      SchemaException - if any errors are found in the attributes
    • isImportedNamespace

      public boolean isImportedNamespace(NamespaceUri 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 class SchemaElement
      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 class SchemaElement
      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 class SchemaElement
      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 class SchemaElement
      Parameters:
      compiler - used for reporting errors
      Throws:
      SchemaException - if errors are found
    • getTargetNamespace

      public NamespaceUri getTargetNamespace()
      Get the target namespace of this schema document.
      Returns:
      NamespaceUri.NULL for the no-namespace case
    • getAttributeFormDefault

      public 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 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 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(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(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, String mode, boolean appliesToEmpty)
      Set the open content wildcard and mode
      Parameters:
      wildcard - the default open content wildcard
      mode - the default open content mode, as a string
      appliesToEmpty - true if the default open content wildcard applies to types that would otherwise have variety empty
    • getXPathDefaultNamespace

      public 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 Collection<GlobalParam> getGlobalParams()
      Return the set of global parameters defined in this schema document
      Returns:
      the set of global parameters