com.icl.saxon.tinytree

Class TinyAttributeImpl

final class TinyAttributeImpl extends TinyNodeImpl implements Attr

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

Constructor Summary
TinyAttributeImpl(TinyDocumentImpl doc, int nodeNr)
Method Summary
voidcopy(Outputter out)
Copy this node to a given outputter
StringgenerateId()
Generate id.
StringgetDisplayName()
Get the display name of this node.
intgetFingerprint()
Get the fingerprint of the node, used for matching names
intgetLineNumber()
Get the line number of the node within its source document entity
StringgetLocalName()
Get the local name of this node.
intgetNameCode()
Get the name code of the node, used for finding names in the name pool
shortgetNodeType()
Return the type of node.
NodeInfogetParent()
Get the parent node
StringgetPrefix()
Get the prefix part of the name of this node.
TypeInfogetSchemaTypeInfo()
The type information associated with this attribute.
protected longgetSequenceNumber()
Get the node sequence number (in document order).
StringgetStringValue()
Return the character value of the node.
StringgetURI()
Get the URI part of the name of this node.
booleanisId()
Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not.

Constructor Detail

TinyAttributeImpl

public TinyAttributeImpl(TinyDocumentImpl doc, int nodeNr)

Method Detail

copy

public void copy(Outputter out)
Copy this node to a given outputter

generateId

public String generateId()
Generate id. Returns key of owning element with the attribute name as a suffix

getDisplayName

public 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.

Returns: The display name of this node. For a node with no name, return an empty string.

getFingerprint

public int getFingerprint()
Get the fingerprint of the node, used for matching names

getLineNumber

public int getLineNumber()
Get the line number of the node within its source document entity

getLocalName

public String getLocalName()
Get the local name of this node.

Returns: The local name of this node. For a node with no name, return an empty string.

getNameCode

public int getNameCode()
Get the name code of the node, used for finding names in the name pool

getNodeType

public final short getNodeType()
Return the type of node.

Returns: Node.ATTRIBUTE

getParent

public NodeInfo getParent()
Get the parent node

getPrefix

public String getPrefix()
Get the prefix part of the name of this node. This is the name before the ":" if any.

Returns: the prefix part of the name. For an unnamed node, return null.

getSchemaTypeInfo

public TypeInfo getSchemaTypeInfo()
The type information associated with this attribute. While the type information contained in this attribute is guarantee to be correct after loading the document or invoking Document.normalizeDocument(), schemaTypeInfo may not be reliable if the node was moved.

Since: DOM Level 3

getSequenceNumber

protected long getSequenceNumber()
Get the node sequence number (in document order). Sequence numbers are monotonic but not consecutive. In the current implementation, parent nodes (elements and roots) have a zero least-significant word, while namespaces, attributes, text nodes, comments, and PIs have the top word the same as their owner and the bottom half reflecting their relative position.

getStringValue

public String getStringValue()
Return the character value of the node.

Returns: the attribute value

getURI

public final String getURI()
Get the URI part of the name of this node.

Returns: The URI of the namespace of this node. For the default namespace, return an empty string

isId

public boolean isId()
Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not. When it is and its value is unique, the ownerElement of this attribute can be retrieved using the method Document.getElementById . The implementation could use several ways to determine if an attribute node is known to contain an identifier:
If validation occurred while invoking Document.normalizeDocument(), all user-determined ID attributes are reset and all attribute nodes ID information are then reevaluated in accordance to the schema used. As a consequence, if the Attr.schemaTypeInfo attribute contains an ID type, isId will always return true.

Since: DOM Level 3