net.sf.saxon.tinytree

Class TinyAttributeImpl

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

Constructor Summary
TinyAttributeImpl(TinyTree tree, int nodeNr)
Method Summary
Valueatomize()
Get the typed value.
voidcopy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)
Copy this node to a given outputter
voidgenerateId(FastStringBuffer buffer)
Generate id.
intgetColumnNumber()
Get the column number of the node within its source document entity
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
StringgetLocalPart()
Get the local name of this node.
intgetNameCode()
Get the name code of the node, used for finding names in the name pool
intgetNodeKind()
Return the type of node.
NodeInfogetParent()
Get the parent node
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).
StringgetStringValue()
Return the string value of the node.
CharSequencegetStringValueCS()
Return the string value of the node.
intgetTypeAnnotation()
Get the type annotation of this node, if any The bit 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.
SequenceIteratorgetTypedValue()
Get the typed value of the item.
StringgetURI()
Get the URI part of the name of this node.
booleanisId()
Determine whether this node has the is-id property
booleanisIdref()
Determine whether this node has the is-idref property
booleanisNilled()
Determine whether the node has the is-nilled property
voidsetSystemId(String uri)

Constructor Detail

TinyAttributeImpl

public TinyAttributeImpl(TinyTree tree, int nodeNr)

Method Detail

atomize

public Value atomize()
Get the typed value. The result of this method will always be consistent with the method getTypedValue. However, this method is often more convenient and may be more efficient, especially in the common case where the value is expected to be a singleton.

Returns: the typed value. This will either be a single AtomicValue or a Value whose items are atomic values.

Since: 8.5

copy

public void copy(Receiver out, int whichNamespaces, boolean copyAnnotations, int locationId)
Copy this node to a given outputter

generateId

public void generateId(FastStringBuffer buffer)
Generate id. Returns key of owning element with the attribute namecode as a suffix

Parameters: buffer Buffer to contain the generated ID value

getColumnNumber

public int getColumnNumber()
Get the column number of the node within its source document entity

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

getLocalPart

public String getLocalPart()
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

getNodeKind

public final int getNodeKind()
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.

getRoot

public NodeInfo getRoot()
Get the root node of the tree (not necessarily a document node)

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.

getStringValue

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

Returns: the attribute value

getStringValueCS

public CharSequence getStringValueCS()
Return the string value of the node.

Returns: the attribute value

getTypeAnnotation

public int getTypeAnnotation()
Get the type annotation of this node, if any The bit 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

getTypedValue

public SequenceIterator getTypedValue()
Get the typed value of the item.

For a node, this is the typed value as defined in the XPath 2.0 data model. Since a node may have a list-valued data type, the typed value is in general a sequence, and it is returned in the form of a SequenceIterator.

If the node has not been validated against a schema, the typed value will be the same as the string value, either as an instance of xs:string or as an instance of xs:untypedAtomic, depending on the node kind.

For an atomic value, this method returns an iterator over a singleton sequence containing the atomic value itself.

Returns: an iterator over the items in the typed value of the node or atomic value. The items returned by this iterator will always be atomic values.

Throws: net.sf.saxon.trans.XPathException where no typed value is available, for example in the case of an element with complex content

Since: 8.4

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()
Determine whether this node has the is-id property

Returns: true if the node is an ID

isIdref

public boolean isIdref()
Determine whether this node has the is-idref property

Returns: true if the node is an IDREF or IDREFS element or attribute

isNilled

public boolean isNilled()
Determine whether the node has the is-nilled property

Returns: true if the node has the is-nilled property

setSystemId

public void setSystemId(String uri)