|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.saxon.tree.NodeImpl
net.sf.saxon.tree.ElementImpl
net.sf.saxon.tree.ElementWithAttributes
com.saxonica.sdoc.SchemaElement
public abstract class SchemaElement
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.NodeImpl |
---|
NODE_LETTER |
Fields inherited from interface net.sf.saxon.om.NodeInfo |
---|
ALL_NAMESPACES, EMPTY_NAMESPACE_LIST, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES |
Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
---|
EMPTY_VALUE_ARRAY |
Constructor Summary | |
---|---|
SchemaElement()
|
Method Summary | |
---|---|
void |
addChild(NodeImpl node,
int index)
Add a child node to this node. |
void |
allowAttributes(AttributeCollection atts,
String[] allowed)
Check the attributes of an element against a list of allowed attributes. |
void |
checkMutuallyExclusiveAttributes(String name1,
String name2)
This method tests whether two attributes coexist and reports an error if they do |
void |
compact(int size)
Compact the space used by this node |
void |
duplicate(String category,
String name)
This method is called when two objects in the same symbol space within a schema have duplicate names |
void |
duplicateElement(String name)
This method is called when two occurrences of a child element are found and only one is allowed. |
AxisIterator |
enumerateChildren(NodeTest test)
Get an enumeration of the children of this node |
void |
error(SchemaException exception)
|
void |
error(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 |
NodeInfo |
getFirstChild()
Get the first child node of the element |
NodeInfo |
getLastChild()
Get the last child node of the element |
int |
getLineNumber()
Get the line number |
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. |
String |
getStringValue()
Return the string-value of the node, that is, the concatenation of the character content of all descendent elements and text nodes. |
CharSequence |
getStringValueCS()
Get the value of the item as a CharSequence. |
XSDSchema |
getXSDSchema()
Get the owning XSDSchema element. |
boolean |
hasChildNodes()
Determine if the node has any children. |
void |
illegalElement(NodeInfo child)
This method is called when an illegal Element is encountered. |
String |
indefiniteArticle(String word,
String start)
Construct an indefinite article in English |
void |
invalidAttributeValue(String name,
String value,
String message)
This method is called when an invalid attribute value is found |
void |
missingAttribute(String name)
This method is called when a required attribute is not found |
void |
missingChildElement(String name)
This method is called when a required child element is not found |
void |
mustBeFirstElement(String name)
This method is called when a child element is required to be the first child, but is found elsewhere |
void |
mustBeLastElement(String name)
This method is called when a child element is required to be the first child, but is found elsewhere |
void |
mustPrecede(String name1,
String name2)
This method is called when two child elements are found in the wrong order. |
void |
mutuallyExclusive(String name1,
String name2)
This method is called when two child elements may not coexist |
void |
mutuallyExclusiveAttributes(String name1,
String name2)
This method is called when two attributes may not coexist |
void |
mutuallyExclusiveElementAndAttribute(String elem,
String att)
This method is called when an attribute and a child elements may not coexist |
int |
parseFinalOrBlock(String attrName,
String finalValue,
int allowed)
Parse a list of blocked or final derivations. |
void |
postValidate(SchemaCompiler compiler)
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 |
int |
processMaxOccurs(String attValue)
Process the value of a maxOccurs attribute on any element where it appears |
int |
processMinOccurs(String attValue)
Process the value of a minOccurs attribute on any element where it appears |
void |
requireAttribute(AttributeCollection atts,
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 |
useChildrenArray(NodeImpl[] array)
Supply an array to be used for the array of children. |
void |
validate(SchemaCompiler compiler)
Check that the schema element is valid. |
void |
validateSubtree(SchemaCompiler compiler)
Recursive walk through the schema to validate all nodes |
void |
warning(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 |
---|
generateId, getBaseURI, getDocumentRoot, getNameCode, getNodeKind, getRoot, getSystemId, setNameCode, setSystemId |
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 |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int USE_DEFAULT_NS
public static final int REQUIRE_TARGET_NS
public static final int REQUIRE_NULL_NS
Constructor Detail |
---|
public SchemaElement()
Method Detail |
---|
public void setSchemaNodeFactory(SchemaNodeFactory factory)
factory
- the schema node factorypublic SchemaNodeFactory getSchemaNodeFactory()
public void setLineNumber(int line)
setLineNumber
in class ElementImpl
public int getLineNumber()
getLineNumber
in interface SourceLocator
getLineNumber
in interface NodeInfo
getLineNumber
in class ElementImpl
public void processAllAttributes() throws SchemaException
SchemaException
public abstract void prepareAttributes() throws SchemaException
SchemaException
public void allowAttributes(AttributeCollection atts, String[] allowed) throws SchemaException
atts
- the attributes actually presentallowed
- the attributes that are allowed for this element. Note that
SchemaException
public void requireAttribute(AttributeCollection atts, String required) throws SchemaException
atts
- the attribtue collectionrequired
- the local name of the required attribute, which must be in the null namespace
SchemaException
public void validateSubtree(SchemaCompiler compiler) throws SchemaException
compiler
-
SchemaException
public void validate(SchemaCompiler compiler) throws SchemaException
compiler
-
SchemaException
public void postValidate(SchemaCompiler compiler) throws SchemaException
compiler
-
SchemaException
public XSDSchema getXSDSchema() throws SchemaException
SchemaException
- if none is found (which means the schema is invalid)public PreparedSchema getSchema() throws SchemaException
SchemaException
public UserComplexType getContainingComplexType() throws SchemaException
SchemaException
- if not contained in an xs:complexTypepublic SimpleTypeDefinition getContainingSimpleType() throws SchemaException
SchemaException
- if not contained in an xs:simpleTypepublic void error(String err) throws SchemaException
err
- the error message to report
SchemaException
public void error(SchemaException exception) throws SchemaException
SchemaException
public void warning(String err)
public void illegalElement(NodeInfo child) throws SchemaException
child
-
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public void duplicateElement(String name) throws SchemaException
name
- the name of the illegal element
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public void duplicate(String category, String name) throws SchemaException
category
- the name of the first attributename
- the name of the second attribute
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public void mutuallyExclusive(String name1, String name2) throws SchemaException
name1
- the name of the first elementname2
- the name of the second element
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public void mutuallyExclusiveElementAndAttribute(String elem, String att) throws SchemaException
elem
- the name of the elementatt
- the name of the attribute
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public void mutuallyExclusiveAttributes(String name1, String name2) throws SchemaException
name1
- the name of the first attributename2
- the name of the second attribute
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public void checkMutuallyExclusiveAttributes(String name1, String name2) throws SchemaException
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)
SchemaException
public void mustPrecede(String name1, String name2) throws SchemaException
name1
- the name of the element that should be firstname2
- the name of the element that should be second
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public void mustBeFirstElement(String name) throws SchemaException
name
- the name of the illegal element
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public String indefiniteArticle(String word, String start)
public void mustBeLastElement(String name) throws SchemaException
name
- the name of the illegal element
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public void invalidAttributeValue(String name, String value, String message) throws SchemaException
name
- the name of the attributevalue
- the supplied value of the attributemessage
- additional explanation of why it's wrong. May be null.
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public void missingAttribute(String name) throws SchemaException
name
- the name of the attribute
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public void missingChildElement(String name) throws SchemaException
name
- the name of the required child element
SchemaException
- thrown if the errorListener
decides that it's a fatal error.public int parseFinalOrBlock(String attrName, String finalValue, int allowed) throws SchemaException
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.
SchemaException
public void processId() throws SchemaException
SchemaException
- if the id is present and is invalid or is a duplicatepublic int processMaxOccurs(String attValue) throws SchemaException
attValue
- the value of the attribute as written, either "unbounded" or an integer
SchemaException
- if the value is invalid (in which case the error will have been reported).
If the value is a very high integer (greater than Integer.MAX_VALUE), the method outputs a warning
and treats the value as "unbounded".public int processMinOccurs(String attValue) throws SchemaException
attValue
- the value of the attribute as written, an integer
SchemaException
- if the value is invalid (in which case the error will have been reported).
If the value is a very high integer (greater than Integer.MAX_VALUE), the method outputs a warning
and treats the value as Integer.MAX_VALUE.public final boolean hasChildNodes()
hasChildNodes
in interface NodeInfo
hasChildNodes
in class NodeImpl
true
if the node has any children,
false
if the node has no children.public final AxisIterator enumerateChildren(NodeTest test)
test
- A NodeTest to be satisfied by the child nodes, or null
if all child node are to be returnedpublic final NodeInfo getFirstChild()
getFirstChild
in class NodeImpl
public final NodeInfo getLastChild()
getLastChild
in class NodeImpl
public String getStringValue()
Item.getStringValueCS()
public CharSequence getStringValueCS()
NodeImpl
getStringValueCS
in interface Item
getStringValueCS
in interface ValueRepresentation
getStringValueCS
in class NodeImpl
Item.getStringValue()
public void useChildrenArray(NodeImpl[] array)
public void addChild(NodeImpl node, int index)
public void compact(int size)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |