Package net.sf.saxon.tinytree
Class TinyAttributeImpl
- java.lang.Object
-
- net.sf.saxon.tinytree.TinyNodeImpl
-
- net.sf.saxon.tinytree.TinyAttributeImpl
-
- All Implemented Interfaces:
javax.xml.transform.Source,javax.xml.transform.SourceLocator,ExtendedNodeInfo,FingerprintedNode,Item,NodeInfo,ValueRepresentation
final class TinyAttributeImpl extends TinyNodeImpl
A node in the XML parse tree representing an attribute. Note that this is generated only "on demand", when the attribute is selected by a select pattern.- Author:
- Michael H. Kay
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.tinytree.TinyNodeImpl
NODE_LETTER, nodeNr, parent, tree
-
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
Constructors Constructor Description TinyAttributeImpl(TinyTree tree, int nodeNr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcopy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)Copy this node to a given outputtervoidgenerateId(FastStringBuffer buffer)Generate id.java.lang.StringgetDisplayName()Get the display name of this node.intgetFingerprint()Get the fingerprint of the node, used for matching namesintgetLineNumber()Get the line number of the node within its source document entityjava.lang.StringgetLocalPart()Get the local name of this node.intgetNameCode()Get the name code of the node, used for finding names in the name poolintgetNodeKind()Return the type of node.NodeInfogetParent()Get the parent nodejava.lang.StringgetPrefix()Get the prefix part of the name of this node.NodeInfogetRoot()Get the root node of the tree (not necessarily a document node)protected longgetSequenceNumber()Get the node sequence number (in document order).java.lang.StringgetStringValue()Return the string value of the node.java.lang.CharSequencegetStringValueCS()Return the string value of the node.intgetTypeAnnotation()Get the type annotation of this node, if any The bitNodeInfo.IS_DTD_TYPE(1<<30) will be set in the case of an attribute node if the type annotation is one of ID, IDREF, or IDREFS and this is derived from DTD rather than schema validation.java.lang.StringgetURI()Get the URI part of the name of this node.booleanisId()Determine whether this node has the is-id propertybooleanisIdref()Determine whether this node has the is-idref property-
Methods inherited from class net.sf.saxon.tinytree.TinyNodeImpl
atomize, compareOrder, equals, getAttributeValue, getBaseURI, getColumnNumber, getConfiguration, getDeclaredNamespaces, getDocumentNumber, getDocumentRoot, getNamePool, getNodeNumber, getParentNodeNr, getPublicId, getSystemId, getTypedValue, hasChildNodes, hashCode, isAncestorOrSelf, isNilled, isSameNodeInfo, iterateAxis, iterateAxis, sendNamespaceDeclarations, setParentNode, setSystemId
-
-
-
-
Constructor Detail
-
TinyAttributeImpl
public TinyAttributeImpl(TinyTree tree, int nodeNr)
-
-
Method Detail
-
getParent
public NodeInfo getParent()
Get the parent node- Specified by:
getParentin interfaceNodeInfo- Overrides:
getParentin classTinyNodeImpl- Returns:
- The Node object describing the containing element or root node.
-
getRoot
public NodeInfo getRoot()
Get the root node of the tree (not necessarily a document node)- Specified by:
getRootin interfaceNodeInfo- Overrides:
getRootin classTinyNodeImpl- Returns:
- the NodeInfo representing the root of this tree
-
getSequenceNumber
protected long getSequenceNumber()
Get the node sequence number (in document order). Sequence numbers are monotonic but not consecutive. In this implementation, elements have a zero least-significant word, while attributes and namespaces use the same value in the top word as the containing element, and use the bottom word to hold a sequence number, which numbers namespaces first and then attributes.- Overrides:
getSequenceNumberin classTinyNodeImpl
-
getNodeKind
public final int getNodeKind()
Return the type of node.- Returns:
- Node.ATTRIBUTE
- See Also:
Type
-
getStringValueCS
public java.lang.CharSequence getStringValueCS()
Return the string value of the node.- Specified by:
getStringValueCSin interfaceItem- Specified by:
getStringValueCSin interfaceValueRepresentation- Overrides:
getStringValueCSin classTinyNodeImpl- Returns:
- the attribute value
- See Also:
Item.getStringValue()
-
getStringValue
public java.lang.String getStringValue()
Return the string value of the node.- Returns:
- the attribute value
- See Also:
Item.getStringValueCS()
-
getFingerprint
public int getFingerprint()
Get the fingerprint of the node, used for matching names- Specified by:
getFingerprintin interfaceNodeInfo- Overrides:
getFingerprintin classTinyNodeImpl- Returns:
- an integer fingerprint; two nodes with the same fingerprint have the same expanded QName. For unnamed nodes (text nodes, comments, document nodes, and namespace nodes for the default namespace), returns -1.
-
getNameCode
public int getNameCode()
Get the name code of the node, used for finding names in the name pool- Specified by:
getNameCodein interfaceNodeInfo- Overrides:
getNameCodein classTinyNodeImpl- Returns:
- an integer name code, which may be used to obtain the actual node name from the name pool. For unnamed nodes (text nodes, comments, document nodes, and namespace nodes for the default namespace), returns -1.
- See Also:
allocate,getFingerprint
-
getPrefix
public java.lang.String getPrefix()
Get the prefix part of the name of this node. This is the name before the ":" if any.- Specified by:
getPrefixin interfaceNodeInfo- Overrides:
getPrefixin classTinyNodeImpl- Returns:
- the prefix part of the name. For an unnamed node, return null.
-
getDisplayName
public java.lang.String getDisplayName()
Get the display name of this node. For elements and attributes this is [prefix:]localname. For unnamed nodes, it is an empty string.- Specified by:
getDisplayNamein interfaceNodeInfo- Overrides:
getDisplayNamein classTinyNodeImpl- Returns:
- The display name of this node. For a node with no name, return an empty string.
-
getLocalPart
public java.lang.String getLocalPart()
Get the local name of this node.- Specified by:
getLocalPartin interfaceNodeInfo- Overrides:
getLocalPartin classTinyNodeImpl- Returns:
- The local name of this node. For a node with no name, return an empty string.
-
getURI
public final java.lang.String getURI()
Get the URI part of the name of this node.- Specified by:
getURIin interfaceNodeInfo- Overrides:
getURIin classTinyNodeImpl- Returns:
- The URI of the namespace of this node. For the default namespace, return an empty string
-
getTypeAnnotation
public int getTypeAnnotation()
Get the type annotation of this node, if any The bitNodeInfo.IS_DTD_TYPE(1<<30) will be set in the case of an attribute node if the type annotation is one of ID, IDREF, or IDREFS and this is derived from DTD rather than schema validation. Returns UNTYPED_ATOMIC if there is no type annotation- Specified by:
getTypeAnnotationin interfaceNodeInfo- Overrides:
getTypeAnnotationin classTinyNodeImpl- Returns:
- the type annotation of the node, under the mask NamePool.FP_MASK, and optionally the
bit setting IS_DTD_TYPE in the case of a DTD-derived ID or IDREF/S type (which is treated
as untypedAtomic for the purposes of obtaining the typed value).
The result is undefined for nodes other than elements and attributes.
-
generateId
public void generateId(FastStringBuffer buffer)
Generate id. Returns key of owning element with the attribute namecode as a suffix- Specified by:
generateIdin interfaceNodeInfo- Overrides:
generateIdin classTinyNodeImpl- Parameters:
buffer- Buffer to contain the generated ID value
-
copy
public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId) throws XPathException
Copy this node to a given outputter- Parameters:
out- the Receiver to which the node should be copiedwhichNamespaces- in the case of an element, controls which namespace nodes should be copied. Values areNodeInfo.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- Throws:
XPathException
-
getLineNumber
public int getLineNumber()
Get the line number of the node within its source document entity- Specified by:
getLineNumberin interfaceNodeInfo- Specified by:
getLineNumberin interfacejavax.xml.transform.SourceLocator- Overrides:
getLineNumberin classTinyNodeImpl- Returns:
- the line number of the node in its original source document; or -1 if not available
-
isId
public boolean isId()
Determine whether this node has the is-id property- Specified by:
isIdin interfaceExtendedNodeInfo- Overrides:
isIdin classTinyNodeImpl- Returns:
- true if the node is an ID
-
isIdref
public boolean isIdref()
Determine whether this node has the is-idref property- Specified by:
isIdrefin interfaceExtendedNodeInfo- Overrides:
isIdrefin classTinyNodeImpl- Returns:
- true if the node is an IDREF or IDREFS element or attribute
-
-