Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.saxonica.sdoc
Class SchemaElement

    java.lang.Object
      net.sf.saxon.tree.NodeImpl
          net.sf.saxon.tree.ParentNodeImpl
              net.sf.saxon.tree.ElementImpl
                  net.sf.saxon.tree.ElementWithAttributes
                      com.saxonica.sdoc.SchemaElement

All Implemented Interfaces:
  FingerprintedNode, Item, NodeInfo, javax.xml.transform.Source, javax.xml.transform.SourceLocator, ValueRepresentation

Direct Known Subclasses:
  AnnotationParent, UnknownElement, XSDAnnotation, XSDAttribute, XSDAttributeGroup, XSDComplexContent, XSDComplexContentRestriction, XSDComplexType, XSDCompositor, XSDDocumentation, XSDElement, XSDExtension, XSDGroup, XSDIdentityConstraint, XSDList, XSDRedefine, XSDSchema, XSDSimpleContent, XSDSimpleContentRestriction, XSDSimpleType, XSDSimpleTypeRestriction, XSDUnion

public abstract class SchemaElement
extends ElementWithAttributes

An element in an XML Schema document

Field Summary
`static int` | `REQUIRE_NULL_NS` Option indicating "no namespace prefix is allowed; the name is in the null Namespace"
`static int` | `REQUIRE_TARGET_NS` Option indicating "no namespace prefix is allowed; the name is in the targetNamespace"
`static int` | `USE_DEFAULT_NS` Option indicating "use the default element namespace when unprefixed"

Fields inherited from class net.sf.saxon.tree.ElementWithAttributes
`attributeList, namespaceList`

Fields inherited from class net.sf.saxon.tree.ElementImpl
`nameCode, root, sequence`

Fields inherited from class net.sf.saxon.tree.NodeImpl
`index, NODE_LETTER, parent`

Fields inherited from interface net.sf.saxon.om.NodeInfo
`ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, LOCAL_NAMESPACES, NO_NAMESPACES`

Fields inherited from interface net.sf.saxon.om.ValueRepresentation
`EMPTY_VALUE_ARRAY`

Constructor Summary
`SchemaElement()`

Method Summary
`protected int` | `allocateAnonymousTypeCode()` Allocate a name to an anonymous type.
`void` | `allowAttributes(AttributeCollection atts, java.lang.String[] allowed)` Check the attributes of an element against a list of allowed attributes.
`void` | `checkMutuallyExclusiveAttributes(java.lang.String name1, java.lang.String name2)` This method tests whether two attributes coexist and reports an error if they do
`void` | `duplicate(java.lang.String category, java.lang.String name)` This method is called when two objects in the same symbol space within a schema have duplicate names
`void` | `duplicateElement(java.lang.String name)` This method is called when two occurrences of a child element are found and only one is allowed.
`void` | `error(java.lang.String err)` This method is called for a general error.
`UserComplexType` | `getContainingComplexType()` Get the complexType associated with the containing xs:complexType element
`SimpleTypeDefinition` | `getContainingSimpleType()` Get the simpleTypeDefinition associated with the containing xs:simpleType element
`protected int` | `getFingerprint(java.lang.String name, int option)` This method is called to check that a QName is valid and allocate a fingerprint for the name in the namePool.
`int` | `getLineNumber()` Get the line number
`protected int` | `getNameCode(java.lang.String name, int option)`
`PreparedSchema` | `getSchema()` Get the schema corresponding to the contents of the schema document containing this element
`SchemaNodeFactory` | `getSchemaNodeFactory()` Get the nodeFactory used to create this element.
`XSDSchema` | `getXSDSchema()` Get the owning XSDSchema element.
`void` | `illegalElement(NodeInfo child)` This method is called when an illegal Element is encountered.
`java.lang.String` | `indefiniteArticle(java.lang.String word, java.lang.String start)` Construct an indefinite article in English
`void` | `invalidAttributeValue(java.lang.String name, java.lang.String value, java.lang.String message)` This method is called when an invalid attribute value is found
`protected boolean` | `isTopLevel()` Return true if this element is a child of xs:schema or xs:redefine
`void` | `missingAttribute(java.lang.String name)` This method is called when a required attribute is not found
`void` | `missingChildElement(java.lang.String name)` This method is called when a required child element is not found
`void` | `mustBeFirstElement(java.lang.String name)` This method is called when a child element is required to be the first child, but is found elsewhere
`void` | `mustBeLastElement(java.lang.String name)` This method is called when a child element is required to be the first child, but is found elsewhere
`void` | `mustPrecede(java.lang.String name1, java.lang.String name2)` This method is called when two child elements are found in the wrong order.
`void` | `mutuallyExclusive(java.lang.String name1, java.lang.String name2)` This method is called when two child elements may not coexist
`void` | `mutuallyExclusiveAttributes(java.lang.String name1, java.lang.String name2)` This method is called when two attributes may not coexist
`void` | `mutuallyExclusiveElementAndAttribute(java.lang.String elem, java.lang.String att)` This method is called when an attribute and a child elements may not coexist
`int` | `parseFinalOrBlock(java.lang.String attrName, java.lang.String finalValue, int allowed)` Parse a list of blocked or final derivations.
`void` | `postValidate()` Hook to allow additional validation of a parent element immediately after its children have been validated.
`abstract void` | `prepareAttributes()` Set the attribute list for the element.
`void` | `processAllAttributes()` Process the attributes of this element and all its children
`void` | `processId()` Process an @id attribute on the schema element: if present, check that it is a valid ID, and that it is unique in the schema document
`void` | `requireAttribute(AttributeCollection atts, java.lang.String required)` Indicate that a particular attribute is required
`void` | `setLineNumber(int line)` Set the line number
`void` | `setSchemaNodeFactory(SchemaNodeFactory factory)` Set the nodeFactory used to create this element.
`void` | `validate()` Check that the schema element is valid.
`protected void` | `validateChildren()` Validate the children of this node, recursively.
`void` | `validateSubtree()` Recursive walk through the stylesheet to validate all nodes
`void` | `warning(java.lang.String err)`

Methods inherited from class net.sf.saxon.tree.ElementWithAttributes
`copy, getAttributeList, getAttributeValue, getDeclaredNamespaces, getInScopeNamespaceCodes, getPrefixForURI, getURICodeForPrefix, getURIForPrefix, initialise, iteratePrefixes, sendNamespaceDeclarations, setNamespaceDeclarations`

Methods inherited from class net.sf.saxon.tree.ElementImpl
`addChild, compact, enumerateChildren, generateId, getBaseURI, getDocumentRoot, getFirstChild, getLastChild, getNameCode, getNodeKind, getNthChild, getRoot, getSequenceNumber, getStringValue, getStringValueCS, getSystemId, hasChildNodes, setNameCode, setSystemId, useChildrenArray`

Methods inherited from class net.sf.saxon.tree.NodeImpl
`atomize, compareOrder, equals, getColumnNumber, getConfiguration, getDisplayName, getDocumentNumber, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPrefix, getPreviousInDocument, getPreviousSibling, getPublicId, getTypeAnnotation, getTypedValue, getURI, hashCode, isSameNodeInfo, iterateAxis, iterateAxis`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### USE_DEFAULT_NS

    public static final int USE_DEFAULT_NS

  Option indicating "use the default element namespace when unprefixed"

  See Also:
    Constant Field Values

### REQUIRE_TARGET_NS

    public static final int REQUIRE_TARGET_NS

  Option indicating "no namespace prefix is allowed; the name is in the targetNamespace"

  See Also:
    Constant Field Values

### REQUIRE_NULL_NS

    public static final int REQUIRE_NULL_NS

  Option indicating "no namespace prefix is allowed; the name is in the null Namespace"

  See Also:
    Constant Field Values

Constructor Detail

### SchemaElement

    public SchemaElement()

Method Detail

### isTopLevel

    protected boolean isTopLevel()

  Return true if this element is a child of xs:schema or xs:redefine

  Returns:
    true if this element is a child of xs:schema or xs:redefine

### setSchemaNodeFactory

    public void setSchemaNodeFactory(SchemaNodeFactory factory)

  Set the nodeFactory used to create this element.

  Parameters:
    `factory` - the schema node factory

### getSchemaNodeFactory

    public SchemaNodeFactory getSchemaNodeFactory()

  Get the nodeFactory used to create this element. This nodeFactory is used to keep track of any errors encountered during construction of the schema document

  Returns:
    factory the schema node factory

### setLineNumber

    public void setLineNumber(int line)

  Set the line number

  Overrides:
    `setLineNumber` in class `ElementImpl`

### getLineNumber

    public int getLineNumber()

  Get the line number

  Specified by:
    `getLineNumber` in interface `NodeInfo`
  Overrides:
    `getLineNumber` in class `ElementImpl`

### processAllAttributes

    public void processAllAttributes()
                              throws SchemaException

  Process the attributes of this element and all its children

  Throws:
    `SchemaException`

### prepareAttributes

    public abstract void prepareAttributes()
                                    throws SchemaException

  Set the attribute list for the element. This is called to process the attributes (note the distinction from processAttributes in the superclass). Must be supplied in a subclass

  Throws:
    `SchemaException`

### allowAttributes

    public void allowAttributes(AttributeCollection atts,
                                java.lang.String[] allowed)
                         throws SchemaException

  Check the attributes of an element against a list of allowed attributes. Report an error if any extraneous attribute is present

  Parameters:
    `atts` - the attributes actually present
    `allowed` - the attributes that are allowed for this element. Note that
  Throws:
    `SchemaException`

### requireAttribute

    public void requireAttribute(AttributeCollection atts,
                                 java.lang.String required)
                          throws SchemaException

  Indicate that a particular attribute is required

  Parameters:
    `atts` - the attribtue collection
    `required` - the local name of the required attribute, which must be in the null namespace
  Throws:
    `SchemaException`

### validateSubtree

    public void validateSubtree()
                         throws SchemaException

  Recursive walk through the stylesheet to validate all nodes

  Throws:
    `SchemaException`

### validateChildren

    protected void validateChildren()
                             throws SchemaException

  Validate the children of this node, recursively.

  Throws:
    `SchemaException`

### validate

    public void validate()
                  throws SchemaException

  Check that the schema element is valid. This is called once for each element, after the entire tree has been built. As well as validation, it can perform first-time initialisation. The default implementation does nothing; it is normally overriden in subclasses.

  Throws:
    `SchemaException`

### postValidate

    public void postValidate()
                      throws SchemaException

  Hook to allow additional validation of a parent element immediately after its children have been validated.

  Throws:
    `SchemaException`

### getXSDSchema

    public XSDSchema getXSDSchema()
                           throws SchemaException

  Get the owning XSDSchema element.

  Throws:
    `SchemaException` - if none is found (which means the schema is invalid)

### getSchema

    public PreparedSchema getSchema()
                             throws SchemaException

  Get the schema corresponding to the contents of the schema document containing this element

  Throws:
    `SchemaException`

### getContainingComplexType

    public UserComplexType getContainingComplexType()
                                             throws SchemaException

  Get the complexType associated with the containing xs:complexType element

  Throws:
    `SchemaException` - if not contained in an xs:complexType

### getContainingSimpleType

    public SimpleTypeDefinition getContainingSimpleType()
                                                 throws SchemaException

  Get the simpleTypeDefinition associated with the containing xs:simpleType element

  Throws:
    `SchemaException` - if not contained in an xs:simpleType

### error

    public void error(java.lang.String err)
               throws SchemaException

  This method is called for a general error.

  Parameters:
    `err` - the error message to report
  Throws:
    `SchemaException`

### warning

    public void warning(java.lang.String err)

### getFingerprint

    protected int getFingerprint(java.lang.String name,
                                 int option)
                          throws SchemaException

  This method is called to check that a QName is valid and allocate a fingerprint for the name in the namePool. If the QName isn't valid, the method throws an exception: it is the caller's responsibility to call the error handler and recover from the error. The method makes use of the namespace context information for the schema element.

  Parameters:
    `name` - The QName
    `option` - The option for handling unprefixed names. Options are to use the default namespace, the target namespace, or the null namespace Note that this method assumes the name, if unprefixed, is in the default namespace: NOT the targetNamespace of the schema.
  Returns:
    a fingerprint
  Throws:
    `SchemaException` - if the QName is invalid.

### getNameCode

    protected int getNameCode(java.lang.String name,
                              int option)
                       throws SchemaException

  Throws:
    `SchemaException`

### illegalElement

    public void illegalElement(NodeInfo child)
                        throws SchemaException

  This method is called when an illegal Element is encountered.

  Parameters:
    `child` -
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### duplicateElement

    public void duplicateElement(java.lang.String name)
                          throws SchemaException

  This method is called when two occurrences of a child element are found and only one is allowed.

  Parameters:
    `name` - the name of the illegal element
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### duplicate

    public void duplicate(java.lang.String category,
                          java.lang.String name)
                   throws SchemaException

  This method is called when two objects in the same symbol space within a schema have duplicate names

  Parameters:
    `category` - the name of the first attribute
    `name` - the name of the second attribute
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### mutuallyExclusive

    public void mutuallyExclusive(java.lang.String name1,
                                  java.lang.String name2)
                           throws SchemaException

  This method is called when two child elements may not coexist

  Parameters:
    `name1` - the name of the first element
    `name2` - the name of the second element
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### mutuallyExclusiveElementAndAttribute

    public void mutuallyExclusiveElementAndAttribute(java.lang.String elem,
                                                     java.lang.String att)
                                              throws SchemaException

  This method is called when an attribute and a child elements may not coexist

  Parameters:
    `elem` - the name of the element
    `att` - the name of the attribute
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### mutuallyExclusiveAttributes

    public void mutuallyExclusiveAttributes(java.lang.String name1,
                                            java.lang.String name2)
                                     throws SchemaException

  This method is called when two attributes may not coexist

  Parameters:
    `name1` - the name of the first attribute
    `name2` - the name of the second attribute
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### checkMutuallyExclusiveAttributes

    public void checkMutuallyExclusiveAttributes(java.lang.String name1,
                                                 java.lang.String name2)
                                          throws SchemaException

  This method tests whether two attributes coexist and reports an error if they do

  Parameters:
    `name1` - the local name of the first attribute (must be in the null namespace)
    `name2` - the local name of the second attribute (must be in the null namespace)
  Throws:
    `SchemaException`

### mustPrecede

    public void mustPrecede(java.lang.String name1,
                            java.lang.String name2)
                     throws SchemaException

  This method is called when two child elements are found in the wrong order.

  Parameters:
    `name1` - the name of the element that should be first
    `name2` - the name of the element that should be second
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### mustBeFirstElement

    public void mustBeFirstElement(java.lang.String name)
                            throws SchemaException

  This method is called when a child element is required to be the first child, but is found elsewhere

  Parameters:
    `name` - the name of the illegal element
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### indefiniteArticle

    public java.lang.String indefiniteArticle(java.lang.String word,
                                              java.lang.String start)

  Construct an indefinite article in English

### mustBeLastElement

    public void mustBeLastElement(java.lang.String name)
                           throws SchemaException

  This method is called when a child element is required to be the first child, but is found elsewhere

  Parameters:
    `name` - the name of the illegal element
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### invalidAttributeValue

    public void invalidAttributeValue(java.lang.String name,
                                      java.lang.String value,
                                      java.lang.String message)
                               throws SchemaException

  This method is called when an invalid attribute value is found

  Parameters:
    `name` - the name of the attribute
    `value` - the supplied value of the attribute
    `message` - additional explanation of why it's wrong. May be null.
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### missingAttribute

    public void missingAttribute(java.lang.String name)
                          throws SchemaException

  This method is called when a required attribute is not found

  Parameters:
    `name` - the name of the attribute
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### missingChildElement

    public void missingChildElement(java.lang.String name)
                             throws SchemaException

  This method is called when a required child element is not found

  Parameters:
    `name` - the name of the required child element
  Throws:
    `SchemaException` - thrown if the errorListener decides that it's a fatal error.

### parseFinalOrBlock

    public int parseFinalOrBlock(java.lang.String attrName,
                                 java.lang.String finalValue,
                                 int allowed)
                          throws SchemaException

  Parse a list of blocked or final derivations. Used to process the block, final, blockDefault, and finalDefault attributes.

  Parameters:
    `finalValue` - A list of values to be parsed, as a string, for example "extension restriction"
    `allowed` - The permitted values, as a bit-significant integer. For example the value (DERIVE_BY_EXTENSION | DERIVE_BY_RESTRICTION) allows the values "extension" and "restriction" to appear.
  Returns:
    The final/blocked values, as a bit-significant integer
  Throws:
    `SchemaException`

### processId

    public void processId()
                   throws SchemaException

  Process an @id attribute on the schema element: if present, check that it is a valid ID, and that it is unique in the schema document

  Throws:
    `SchemaException` - if the id is present and is invalid or is a duplicate

### allocateAnonymousTypeCode

    protected int allocateAnonymousTypeCode()

  Allocate a name to an anonymous type. It's important that the name allocated should be repeatable, because it can be referenced as a type annotation in a PTree document.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD