net.sf.saxon.tree
final class AttributeImpl extends NodeImpl
It is possible for multiple AttributeImpl objects to represent the same attribute node. The identity of an attribute node is determined by the identity of the element, and the index position of the attribute within the element. Index positions are not reused when an attribute is deleted, and are retained when an attribute is renamed.
This object no longer caches information such as the name code and string value, because these would become invalid when the element node is modified.
Constructor Summary | |
---|---|
AttributeImpl(ElementImpl element, int index)
Construct an Attribute node for the n'th attribute of a given element |
Method Summary | |
---|---|
void | copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)
Copy this node to a given outputter |
void | delete()
Delete this node (that is, detach it from its parent) |
void | generateId(FastStringBuffer buffer)
Get sequential key. |
int | getNameCode()
Get the name code, which enables the name to be located in the name pool |
NodeImpl | getNextInDocument(NodeImpl anchor)
Get the next node in document order (skipping attributes) |
NodeInfo | getNextSibling()
Get next sibling - not defined for attributes |
int | getNodeKind()
Return the type of node. |
NodeImpl | getPreviousInDocument()
Get the previous node in document order (skipping attributes) |
NodeInfo | getPreviousSibling()
Get previous sibling - not defined for attributes |
protected long | getSequenceNumber()
Get the node sequence number (in document order). |
String | getStringValue()
Return the character value of the node. |
int | getTypeAnnotation()
Get the type annotation of this node, if any |
int | hashCode()
The hashCode() method obeys the contract for hashCode(): that is, if two objects are equal
(represent the same node) then they must have the same hashCode() |
boolean | isDeleted()
Test whether this MutableNodeInfo object represents a node that has been deleted.
|
boolean | isId()
Determine whether this node has the is-id property |
boolean | isIdref()
Determine whether this node has the is-idref property |
boolean | isNilled()
Determine whether the node has the is-nilled property |
boolean | isSameNodeInfo(NodeInfo other)
Determine whether this is the same node as another node |
void | removeTypeAnnotation()
Remove type information from this node (and its ancestors, recursively).
|
void | rename(int newNameCode)
Rename this node
|
void | replace(NodeInfo[] replacement, boolean inherit)
Replace this node with a given sequence of nodes |
void | replaceStringValue(CharSequence stringValue) |
void | setTypeAnnotation(int typeCode)
Set the type annotation on a node. |
Parameters: element The element containing the relevant attribute index The index position of the attribute starting at zero
Parameters: buffer a buffer to which the generated ID will be written
Returns: Node.ATTRIBUTE
Returns: the attribute value
Since: 8.7 Previously, the effect of the equals() and hashCode() methods was not defined. Callers should therefore be aware that third party implementations of the NodeInfo interface may not implement the correct semantics.
Returns: true if this node has been deleted
Returns: true if the node is an ID
Returns: true if the node is an IDREF or IDREFS element or attribute
Returns: true if the node has the is-nilled property
Returns: true if this Node object and the supplied Node object represent the same node in the tree.
Parameters: newNameCode the NamePool code of the new name
Parameters: replacement the replacement nodes (which for this version of the method must be attribute nodes). The target attribute node is deleted, and the replacement nodes are added to the parent element; if they have the same names as existing nodes, then the existing nodes will be overwritten. inherit set to true if new child elements are to inherit the in-scope namespaces of their new parent. Not used when replacing attribute nodes.
Throws: IllegalArgumentException if any of the replacement nodes is not an attribute IllegalStateException if two of the replacement nodes have the same name
Parameters: typeCode the type annotation (possibly including high bits set to indicate the isID, isIDREF, and isNilled properties)