public 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.
NODE_LETTER
ALL_NAMESPACES, IS_DTD_TYPE, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES
Constructor and Description |
---|
AttributeImpl(ElementImpl element,
int index)
Construct an Attribute node for the n'th attribute of a given element
|
Modifier and Type | Method and Description |
---|---|
void |
copy(Receiver out,
int copyOptions,
Location 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 |
getFingerprint()
Get the fingerprint of the node.
|
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)
|
NodeImpl |
getNextSibling()
Get next sibling - not defined for attributes
|
int |
getNodeKind()
Return the type of node.
|
NodeName |
getNodeName()
Get the name of the node.
|
NodeImpl |
getPreviousInDocument()
Get the previous node in document order (skipping attributes)
|
NodeImpl |
getPreviousSibling()
Get previous sibling - not defined for attributes
|
SchemaType |
getSchemaType()
Get the type annotation
|
protected long |
getSequenceNumber()
Get the node sequence number (in document order).
|
String |
getStringValue()
Return the character value of the node.
|
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(NodeName newNameCode)
Rename this node
|
void |
replace(NodeInfo[] replacement,
boolean inherit)
Replace this node with a given sequence of nodes
|
void |
replaceStringValue(CharSequence stringValue)
Replace the string-value of this node.
|
void |
setTypeAnnotation(SchemaType type)
Set the type annotation on a node.
|
addAttribute, addNamespace, atomize, compareOrder, comparePosition, equals, getAttributeValue, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDisplayName, getFirstChild, getLastChild, getLineNumber, getLocalPart, getNamePool, getParent, getPhysicalRoot, getPrefix, getPublicId, getRawParent, getRoot, getSiblingPosition, getStringValueCS, getSuccessorElement, getSystemId, getTreeInfo, getURI, hasChildNodes, head, insertChildren, insertSiblings, iterate, iterateAxis, iterateAxis, newBuilder, removeAttribute, saveLocation, setRawParent, setSiblingPosition, setSystemId
public AttributeImpl(ElementImpl element, int index)
element
- The element containing the relevant attributeindex
- The index position of the attribute starting at zeropublic NodeName getNodeName()
getNodeName
in class NodeImpl
public int getNameCode()
getNameCode
in interface FingerprintedNode
getNameCode
in class NodeImpl
public int getFingerprint()
getFingerprint
in interface FingerprintedNode
getFingerprint
in class NodeImpl
public SchemaType getSchemaType()
getSchemaType
in interface NodeInfo
getSchemaType
in class NodeImpl
public boolean isId()
public boolean isIdref()
public boolean isNilled()
public boolean isSameNodeInfo(NodeInfo other)
isSameNodeInfo
in interface NodeInfo
isSameNodeInfo
in class NodeImpl
other
- the node to be compared with this nodepublic int hashCode()
hashCode
in interface NodeInfo
hashCode
in class Object
protected long getSequenceNumber()
getSequenceNumber
in class NodeImpl
public final int getNodeKind()
Type
public String getStringValue()
Item.getStringValueCS()
public NodeImpl getNextSibling()
getNextSibling
in interface SteppingNode<NodeImpl>
getNextSibling
in class NodeImpl
public NodeImpl getPreviousSibling()
getPreviousSibling
in interface SteppingNode<NodeImpl>
getPreviousSibling
in class NodeImpl
public NodeImpl getPreviousInDocument()
getPreviousInDocument
in class NodeImpl
public NodeImpl getNextInDocument(NodeImpl anchor)
getNextInDocument
in class NodeImpl
anchor
- the scan stops when it reaches a node that is not a descendant of the specified
anchor nodepublic void generateId(FastStringBuffer buffer)
generateId
in interface NodeInfo
generateId
in class NodeImpl
buffer
- a buffer to which the generated ID will be writtenpublic void copy(Receiver out, int copyOptions, Location locationId) throws XPathException
out
- 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 CopyOptions
locationId
- 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 MutableNodeInfo
delete
in class NodeImpl
public boolean isDeleted()
isDeleted
in interface MutableNodeInfo
isDeleted
in class NodeImpl
public void replace(NodeInfo[] replacement, boolean inherit)
replace
in interface MutableNodeInfo
replace
in class NodeImpl
replacement
- the replacement nodes (which for this version of the method must be attribute
nodes - they may use any implementation of the NodeInfo interface).
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.IllegalArgumentException
- if any of the replacement nodes is not an attributeIllegalStateException
- if this node has been deleted or has no parent node
or if two of the replacement nodes have the same namepublic void rename(NodeName newNameCode)
rename
in interface MutableNodeInfo
rename
in class NodeImpl
newNameCode
- the NamePool code of the new namepublic void replaceStringValue(CharSequence stringValue)
MutableNodeInfo
stringValue
- the new string valuepublic void removeTypeAnnotation()
removeTypeAnnotation
in interface MutableNodeInfo
removeTypeAnnotation
in class NodeImpl
public void setTypeAnnotation(SchemaType type)
setTypeAnnotation
in interface MutableNodeInfo
setTypeAnnotation
in class NodeImpl
type
- the type annotation (possibly including high bits set to indicate the isID, isIDREF, and
isNilled properties)Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.