public class ElementImpl extends ParentNodeImpl implements NamespaceResolver
NodeFactory
registered with the LinkedTreeBuilder used to construct the tree.NODE_LETTERIS_DTD_TYPE, IS_NILLED| Constructor and Description |
|---|
ElementImpl()
Construct an empty ElementImpl
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(NodeName nodeName,
SimpleType attType,
java.lang.CharSequence value,
int properties)
Add an attribute to this element node.
|
void |
addNamespace(NamespaceBinding binding)
Add a namespace binding (that is, a namespace node) to this element.
|
void |
addNamespace(java.lang.String prefix,
java.lang.String uri)
Add a namespace node from this node.
|
AttributeMap |
attributes()
Get the attributes of the element
|
void |
copy(Receiver out,
int copyOptions,
Location location)
Copy this node to a given Receiver.
|
void |
delete()
Delete this node (that is, detach it from its parent)
|
protected void |
fixupInsertedNamespaces(boolean inherit)
Ensure that a child element being inserted into a tree has the right namespace declarations.
|
void |
generateId(FastStringBuffer buffer)
Get a character string that uniquely identifies this node
|
NamespaceMap |
getAllNamespaces()
Get the namespace list for this element.
|
java.lang.String |
getAttributeValue(java.lang.String uri,
java.lang.String localName)
Get the value of a given attribute of this node
|
java.lang.String |
getBaseURI()
Get the base URI of this element node.
|
int |
getColumnNumber()
Get the line number of the node within its source document entity
|
NamespaceBinding[] |
getDeclaredNamespaces(NamespaceBinding[] buffer)
Get all namespace undeclarations and undeclarations defined on this element.
|
int |
getLineNumber()
Get the line number of the node within its source document entity
|
int |
getNodeKind()
Return the kind of node.
|
NodeName |
getNodeName()
Get the name of the node.
|
NodeInfo |
getRoot()
Get the root node
|
SchemaType |
getSchemaType()
Get the type annotation
|
java.lang.String |
getSystemId()
Get the system ID of the entity containing this element node.
|
java.lang.String |
getURIForPrefix(java.lang.String prefix,
boolean useDefault)
Get the namespace URI corresponding to a given prefix.
|
void |
initialise(NodeName elemName,
SchemaType elementType,
AttributeMap atts,
NodeInfo parent,
int sequenceNumber)
Initialise a new ElementImpl with an element name
|
boolean |
isId()
Determine whether this node has the is-id property
|
boolean |
isIdref()
Ask whether this node has the is-idref property
|
boolean |
isInScopeNamespace(java.lang.String uri)
Search the in-scope namespaces to see whether a given namespace is in scope.
|
boolean |
isNilled()
Determine whether the node has the is-nilled property
|
java.util.Iterator<java.lang.String> |
iteratePrefixes()
Get an iterator over all the prefixes declared in this namespace context.
|
void |
removeAttribute(NodeInfo attribute)
Remove an attribute from this element node
|
void |
removeNamespace(java.lang.String prefix)
Remove a namespace node from this node.
|
void |
removeTypeAnnotation()
Remove type information from this node (and its ancestors, recursively).
|
void |
rename(NodeName newName)
Rename this node
|
void |
replaceStringValue(java.lang.CharSequence stringValue)
Replace the string-value of this node
|
void |
setAttributeInfo(int index,
AttributeInfo attInfo)
Change details of an attribute of this element
|
void |
setAttributes(AttributeMap atts)
Set the attribute list
|
void |
setLocation(java.lang.String systemId,
int line,
int column)
Set location information for this node
|
void |
setNamespaceMap(NamespaceMap map) |
void |
setNilled()
Say that the element has the nilled property
|
void |
setNodeName(NodeName name)
Set the node name
|
void |
setSystemId(java.lang.String uri)
Set the system ID of this node.
|
void |
setTypeAnnotation(SchemaType type)
Set the type annotation on a node.
|
addChild, children, compact, getFirstChild, getLastChild, getNthChild, getNumberOfChildren, getRawSequenceNumber, getSequenceNumber, getStringValue, getStringValueCS, hasChildNodes, insertChildren, iterateChildren, removeChild, replaceChildrenAt, setChildren, setRawSequenceNumberatomize, compareOrder, effectiveBooleanValue, equals, getConfiguration, getDisplayName, getFingerprint, getLocalPart, getNamePool, getNextInDocument, getNextSibling, getParent, getPhysicalRoot, getPrefix, getPreviousInDocument, getPreviousSibling, getRawParent, getSiblingPosition, getSuccessorElement, getTreeInfo, getURI, hasFingerprint, head, insertSiblings, isDeleted, iterateAxis, iterateAxis, newBuilder, replace, saveLocation, setRawParent, setSiblingPositionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitchildren, equals, getGenre, getPublicId, hashCode, isSameNodeInfo, isStreamed, toShortStringgetLength, itemAt, iterate, reduce, subsequence, toGroundedValueasIterable, concatenate, containsNode, materializemakeRepeatablepublic void setAttributes(AttributeMap atts)
setAttributes in interface MutableNodeInfosetAttributes in class NodeImplatts - the list of attributes of this element (not including namespace attributes)public void setNodeName(NodeName name)
name - the node namepublic void initialise(NodeName elemName, SchemaType elementType, AttributeMap atts, NodeInfo parent, int sequenceNumber)
elemName - Integer representing the element name, with namespaces resolvedelementType - the schema type of the element nodeatts - The attribute list: always nullparent - The parent nodesequenceNumber - Integer identifying this element within the documentpublic NodeName getNodeName()
getNodeName in class NodeImplpublic void setLocation(java.lang.String systemId,
int line,
int column)
systemId - the base URIline - the line number if knowncolumn - the column number if knownpublic void setSystemId(java.lang.String uri)
setSystemId in interface javax.xml.transform.SourcesetSystemId in class NodeImplpublic NodeInfo getRoot()
public final java.lang.String getSystemId()
getSystemId in interface javax.xml.transform.SourcegetSystemId in interface javax.xml.transform.SourceLocatorgetSystemId in interface NodeInfogetSystemId in interface LocationgetSystemId in interface org.xml.sax.LocatorgetSystemId in class NodeImplpublic java.lang.String getBaseURI()
getBaseURI in interface NodeInfogetBaseURI in class NodeImplpublic boolean isNilled()
public void setTypeAnnotation(SchemaType type)
setTypeAnnotation in interface MutableNodeInfosetTypeAnnotation in class NodeImpltype - the type annotationpublic void setNilled()
public SchemaType getSchemaType()
getSchemaType in interface NodeInfogetSchemaType in class NodeImplpublic int getLineNumber()
getLineNumber in interface javax.xml.transform.SourceLocatorgetLineNumber in interface NodeInfogetLineNumber in interface LocationgetLineNumber in interface org.xml.sax.LocatorgetLineNumber in class NodeImplpublic int getColumnNumber()
getColumnNumber in interface javax.xml.transform.SourceLocatorgetColumnNumber in interface NodeInfogetColumnNumber in interface LocationgetColumnNumber in interface org.xml.sax.LocatorgetColumnNumber in class NodeImplpublic void generateId(FastStringBuffer buffer)
generateId in interface NodeInfogenerateId in class NodeImplbuffer - to contain the generated IDpublic final int getNodeKind()
getNodeKind in interface NodeInfoTypepublic AttributeMap attributes()
attributes in interface NodeInfoattributes in class NodeImplpublic void copy(Receiver out, int copyOptions, Location location) throws XPathException
This method is primarily for internal use. It should not be considered a stable part of the Saxon API.
copy in interface NodeInfoout - the Receiver to which the node should be copied. It is the caller's
responsibility to ensure that this Receiver is open before the method is called
(or that it is self-opening), and that it is closed after use.copyOptions - a selection of the options defined in CopyOptionslocation - If non-null, identifies the location of the instruction
that requested this copy. If zero, indicates that the location information
is not availableXPathException - if any downstream error occurspublic void delete()
delete in interface MutableNodeInfodelete in class NodeImplpublic void rename(NodeName newName)
rename in interface MutableNodeInforename in class NodeImplnewName - the new namepublic void addNamespace(NamespaceBinding binding)
addNamespace in interface MutableNodeInfoaddNamespace in class NodeImplbinding - The namespace binding to be
added. If the target element already has a namespace binding with this (prefix, uri) pair, the call has
no effect. If the target element currently has a namespace binding with this prefix and a different URI, an
exception is raised.public void replaceStringValue(java.lang.CharSequence stringValue)
replaceStringValue in interface MutableNodeInfostringValue - the new string valuepublic void setAttributeInfo(int index,
AttributeInfo attInfo)
index - the index position of the attribute to be changedattInfo - new details of the attributepublic void addAttribute(NodeName nodeName, SimpleType attType, java.lang.CharSequence value, int properties)
If this node is not an element, or if the supplied node is not an attribute, the method takes no action. If the element already has an attribute with this name, the method throws an exception.
This method does not perform any namespace fixup. It is the caller's responsibility to ensure that any namespace prefix used in the name of the attribute (or in its value if it has a namespace-sensitive type) is declared on this element.
addAttribute in interface MutableNodeInfoaddAttribute in class NodeImplnodeName - the name of the new attributeattType - the type annotation of the new attributevalue - the string value of the new attributeproperties - properties including IS_ID and IS_IDREF propertiesjava.lang.IllegalStateException - if the element already has an attribute with the given name.public void removeAttribute(NodeInfo attribute)
If this node is not an element, or if the specified node is not an attribute of this element, this method takes no action.
The attribute object itself becomes unusable; any attempt to use this attribute object, or any other object representing the same node, is likely to result in an exception.
removeAttribute in interface MutableNodeInforemoveAttribute in class NodeImplattribute - the attribute node to be removedpublic void removeNamespace(java.lang.String prefix)
removeNamespace in interface MutableNodeInfoprefix - the namespace prefix.public void addNamespace(java.lang.String prefix,
java.lang.String uri)
addNamespace in interface MutableNodeInfoprefix - the namespace prefix. Empty string for the default namespace.uri - The namespace URI.public void removeTypeAnnotation()
removeTypeAnnotation in interface MutableNodeInforemoveTypeAnnotation in class NodeImplpublic void setNamespaceMap(NamespaceMap map)
public java.lang.String getURIForPrefix(java.lang.String prefix,
boolean useDefault)
getURIForPrefix in interface NamespaceResolverprefix - the namespace prefix. May be the zero-length string, indicating
that there is no prefix. This indicates either the default namespace or the
null namespace, depending on the value of useDefault.useDefault - true if the default namespace is to be used when the
prefix is "". If false, the method returns "" when the prefix is "".public java.util.Iterator<java.lang.String> iteratePrefixes()
iteratePrefixes in interface NamespaceResolverpublic boolean isInScopeNamespace(java.lang.String uri)
uri - The URI to be matched.public NamespaceBinding[] getDeclaredNamespaces(NamespaceBinding[] buffer)
getDeclaredNamespaces in interface NodeInfogetDeclaredNamespaces in class NodeImplbuffer - If this is non-null, and the result array fits in this buffer, then the result
may overwrite the contents of this array, to avoid the cost of allocating a new array on the heap.For a node other than an element, the method returns null.
protected void fixupInsertedNamespaces(boolean inherit)
inherit - true if the child is to inherit the inscope namespaces of its new parentpublic NamespaceMap getAllNamespaces()
getAllNamespaces in interface NodeInfogetAllNamespaces in class NodeImplpublic java.lang.String getAttributeValue(java.lang.String uri,
java.lang.String localName)
getAttributeValue in interface NodeInfogetAttributeValue in class NodeImpluri - the namespace URI of the attribute name, or "" if the attribute is not in a namepsacelocalName - the local part of the attribute namepublic boolean isId()
Copyright (c) 2004-2021 Saxonica Limited. All rights reserved.