|
|||||||||
| 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.AttributeImpl
final class AttributeImpl
A node in the "linked" tree representing an attribute. Note that this is generated only "on demand", when the attribute is selected by a path expression.
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.
| Field Summary |
|---|
| 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, IS_NILLED, LOCAL_NAMESPACES, NO_NAMESPACES |
| 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)
Replace the string-value of this node. |
void |
setTypeAnnotation(int typeCode)
Set the type annotation on a node. |
| Methods inherited from class net.sf.saxon.tree.NodeImpl |
|---|
addAttribute, addNamespace, atomize, compareOrder, equals, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDisplayName, getDocumentNumber, getDocumentRoot, getFingerprint, getFirstChild, getLastChild, getLineNumber, getLocalPart, getNamePool, getParent, getPhysicalRoot, getPrefix, getPublicId, getRoot, getSiblingPosition, getStringValueCS, getSystemId, getTypedValue, getURI, hasChildNodes, insertChildren, insertSiblings, iterateAxis, iterateAxis, newBuilder, removeAttribute, setSystemId |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AttributeImpl(ElementImpl element,
int index)
element - The element containing the relevant attributeindex - The index position of the attribute starting at zero| Method Detail |
|---|
public int getNameCode()
getNameCode in interface NodeInfogetNameCode in class NodeImplallocate,
getFingerprintpublic int getTypeAnnotation()
getTypeAnnotation in interface NodeInfogetTypeAnnotation in class NodeImplpublic boolean isId()
isId in interface NodeInfoisId in class NodeImplpublic boolean isIdref()
isIdref in interface NodeInfoisIdref in class NodeImplpublic boolean isNilled()
isNilled in interface NodeInfoisNilled in class NodeImplpublic boolean isSameNodeInfo(NodeInfo other)
isSameNodeInfo in interface NodeInfoisSameNodeInfo in class NodeImplother - the node to be compared with this node
public int hashCode()
hashCode in interface NodeInfohashCode in class Objectprotected long getSequenceNumber()
getSequenceNumber in class NodeImplpublic final int getNodeKind()
Typepublic String getStringValue()
Item.getStringValueCS()public NodeInfo getNextSibling()
getNextSibling in class NodeImplpublic NodeInfo getPreviousSibling()
getPreviousSibling in class NodeImplpublic NodeImpl getPreviousInDocument()
getPreviousInDocument in class NodeImplpublic NodeImpl getNextInDocument(NodeImpl anchor)
getNextInDocument in class NodeImplanchor - the scan stops when it reaches a node that is not a descendant of the specified
anchor node
public void generateId(FastStringBuffer buffer)
generateId in interface NodeInfogenerateId in class NodeImplbuffer - a buffer to which the generated ID will be written
public void copy(Receiver out,
int whichNamespaces,
boolean copyAnnotations,
int 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.whichNamespaces - in the case of an element, controls
which namespace nodes should be copied. Values are NodeInfo.NO_NAMESPACES,
NodeInfo.LOCAL_NAMESPACES, NodeInfo.ALL_NAMESPACEScopyAnnotations - indicates whether the type annotations
of element and attribute nodes should be copiedlocationId - If non-zero, identifies the location of the instruction
that requested this copy. If zero, indicates that the location information
for the original node is to be copied; in this case the Receiver must be
a LocationCopier
XPathExceptionpublic void delete()
delete in interface MutableNodeInfodelete in class NodeImplpublic boolean isDeleted()
isDeleted in interface MutableNodeInfoisDeleted in class NodeImpl
public void replace(NodeInfo[] replacement,
boolean inherit)
replace in interface MutableNodeInforeplace in class NodeImplreplacement - 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.
IllegalArgumentException - if any of the replacement nodes is not an attribute
IllegalStateException - if two of the replacement nodes have the same namepublic void rename(int newNameCode)
rename in interface MutableNodeInforename in class NodeImplnewNameCode - the NamePool code of the new namepublic void replaceStringValue(CharSequence stringValue)
MutableNodeInfo
stringValue - the new string valuepublic void removeTypeAnnotation()
removeTypeAnnotation in interface MutableNodeInforemoveTypeAnnotation in class NodeImplpublic void setTypeAnnotation(int typeCode)
setTypeAnnotation in interface MutableNodeInfosetTypeAnnotation in class NodeImpltypeCode - the type annotation (possibly including high bits set to indicate the isID, isIDREF, and
isNilled properties)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||