Package net.sf.saxon.tree.tiny
Class TinyAttributeImpl
- java.lang.Object
-
- net.sf.saxon.tree.tiny.TinyNodeImpl
-
- net.sf.saxon.tree.tiny.TinyAttributeImpl
-
- All Implemented Interfaces:
javax.xml.transform.Source
,javax.xml.transform.SourceLocator
,GroundedValue
,Item
,NodeInfo
,Sequence
,Location
,org.xml.sax.Locator
public 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.
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.tree.tiny.TinyNodeImpl
NODE_LETTER, nodeNr, parent, tree
-
Fields inherited from interface net.sf.saxon.om.NodeInfo
IS_DTD_TYPE, IS_NILLED
-
-
Constructor Summary
Constructors Constructor Description TinyAttributeImpl(TinyTree tree, int nodeNr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicSequence
atomize()
Get the typed value.void
copy(Receiver out, int copyOptions, Location locationId)
Copy this node to a given outputtervoid
generateId(FastStringBuffer buffer)
Generate id.int
getColumnNumber()
Get the column number of the node within its source document entityjava.lang.String
getDisplayName()
Get the display name of this node.int
getFingerprint()
Get the fingerprint of the node, used for matching namesint
getLineNumber()
Get the line number of the node within its source document entityjava.lang.String
getLocalPart()
Get the local name of this node.int
getNameCode()
Get the name code of the node, used for finding names in the name poolint
getNodeKind()
Return the type of node.TinyNodeImpl
getParent()
Get the parent nodejava.lang.String
getPrefix()
Get the prefix part of the name of this node.NodeInfo
getRoot()
Get the root node of the tree (not necessarily a document node)SchemaType
getSchemaType()
Get the type annotation of this node, if any.protected long
getSequenceNumber()
Get the node sequence number (in document order).java.lang.String
getStringValue()
Return the string value of the node.java.lang.CharSequence
getStringValueCS()
Return the string value of the node.java.lang.String
getSystemId()
Get the system ID for the entity containing the node.java.lang.String
getURI()
Get the URI part of the name of this 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
isDefaultedAttribute()
Ask whether the attribute results from expansion of attribute defaultsboolean
isId()
Determine whether this node has the is-id propertyboolean
isIdref()
Determine whether this node has the is-idref propertyboolean
isNilled()
Determine whether the node has the is-nilled propertyvoid
setSystemId(java.lang.String uri)
Set the system id of this node.-
Methods inherited from class net.sf.saxon.tree.tiny.TinyNodeImpl
compareOrder, equals, getAllNamespaces, getAttributeValue, getBaseURI, getConfiguration, getDeclaredNamespaces, getGenre, getNamePool, getNodeNumber, getTree, getTreeInfo, hasChildNodes, hasFingerprint, head, isAncestorOrSelf, isSameNodeInfo, isStreamed, iterateAxis, iterateAxis, saveLocation, setParentNode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, effectiveBooleanValue, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, itemAt, iterate, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.om.NodeInfo
attributes, children, children, getPublicId, toShortString
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Constructor Detail
-
TinyAttributeImpl
public TinyAttributeImpl(TinyTree tree, int nodeNr)
-
-
Method Detail
-
setSystemId
public void setSystemId(java.lang.String uri)
Description copied from class:TinyNodeImpl
Set the system id of this node.This method is present to ensure that the class implements the javax.xml.transform.Source interface, so a node can be used as the source of a transformation.
- Specified by:
setSystemId
in interfacejavax.xml.transform.Source
- Overrides:
setSystemId
in classTinyNodeImpl
-
getSystemId
public java.lang.String getSystemId()
Description copied from class:TinyNodeImpl
Get the system ID for the entity containing the node.- Specified by:
getSystemId
in interfaceLocation
- Specified by:
getSystemId
in interfaceorg.xml.sax.Locator
- Specified by:
getSystemId
in interfaceNodeInfo
- Specified by:
getSystemId
in interfacejavax.xml.transform.Source
- Specified by:
getSystemId
in interfacejavax.xml.transform.SourceLocator
- Overrides:
getSystemId
in classTinyNodeImpl
- Returns:
- the System Identifier of the entity in the source document containing the node, or null if not known or not applicable.
-
getParent
public TinyNodeImpl getParent()
Get the parent node- Specified by:
getParent
in interfaceNodeInfo
- Overrides:
getParent
in 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:
getRoot
in interfaceNodeInfo
- Overrides:
getRoot
in 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:
getSequenceNumber
in classTinyNodeImpl
- Returns:
- the sequence number
-
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:
getStringValueCS
in interfaceGroundedValue
- Specified by:
getStringValueCS
in interfaceItem
- Overrides:
getStringValueCS
in 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:
getFingerprint
in interfaceNodeInfo
- Overrides:
getFingerprint
in 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
-
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:
getPrefix
in interfaceNodeInfo
- Overrides:
getPrefix
in 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:
getDisplayName
in interfaceNodeInfo
- Overrides:
getDisplayName
in 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:
getLocalPart
in interfaceNodeInfo
- Overrides:
getLocalPart
in 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:
getURI
in interfaceNodeInfo
- Overrides:
getURI
in classTinyNodeImpl
- Returns:
- The URI of the namespace of this node. For the default namespace, return an empty string
-
getSchemaType
public SchemaType getSchemaType()
Get the type annotation of this node, if any. The type annotation is represented as SchemaType object.Types derived from a DTD are not reflected in the result of this method.
- Specified by:
getSchemaType
in interfaceNodeInfo
- Overrides:
getSchemaType
in classTinyNodeImpl
- Returns:
- For element and attribute nodes: the type annotation derived from schema validation (defaulting to xs:untyped and xs:untypedAtomic in the absence of schema validation). For comments, text nodes, processing instructions, and namespaces: null. For document nodes, either xs:untyped if the document has not been validated, or xs:anyType if it has.
- Since:
- 9.4
-
atomize
public AtomicSequence atomize() throws XPathException
Get the typed value.- Returns:
- the typed value. This will either be a single AtomicValue or a Value whose items are atomic values.
- Throws:
XPathException
- if the node has no typed value, for example if it is an element node with element-only content- Since:
- 8.5
-
generateId
public void generateId(FastStringBuffer buffer)
Generate id. Returns key of owning element with the attribute namecode as a suffix- Specified by:
generateId
in interfaceNodeInfo
- Overrides:
generateId
in classTinyNodeImpl
- Parameters:
buffer
- Buffer to contain the generated ID value
-
copy
public void copy(Receiver out, int copyOptions, Location locationId)
Copy this node to a given outputter- Parameters:
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 inCopyOptions
locationId
- If non-null, identifies the location of the instruction that requested this copy. If zero, indicates that the location information is not available
-
getLineNumber
public int getLineNumber()
Get the line number of the node within its source document entity- Specified by:
getLineNumber
in interfaceLocation
- Specified by:
getLineNumber
in interfaceorg.xml.sax.Locator
- Specified by:
getLineNumber
in interfaceNodeInfo
- Specified by:
getLineNumber
in interfacejavax.xml.transform.SourceLocator
- Overrides:
getLineNumber
in classTinyNodeImpl
- Returns:
- the line number of the node in its original source document; or -1 if not available. The default implementation returns -1.
-
getColumnNumber
public int getColumnNumber()
Get the column number of the node within its source document entity- Specified by:
getColumnNumber
in interfaceLocation
- Specified by:
getColumnNumber
in interfaceorg.xml.sax.Locator
- Specified by:
getColumnNumber
in interfaceNodeInfo
- Specified by:
getColumnNumber
in interfacejavax.xml.transform.SourceLocator
- Overrides:
getColumnNumber
in classTinyNodeImpl
- Returns:
- the column number of the node in its original source document; or -1 if not available. The default implementation returns -1.
-
isId
public boolean isId()
Determine whether this node has the is-id property- Specified by:
isId
in interfaceNodeInfo
- Overrides:
isId
in classTinyNodeImpl
- Returns:
- true if the node is an ID
-
isIdref
public boolean isIdref()
Determine whether this node has the is-idref property- Specified by:
isIdref
in interfaceNodeInfo
- Overrides:
isIdref
in classTinyNodeImpl
- 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- Specified by:
isNilled
in interfaceNodeInfo
- Overrides:
isNilled
in classTinyNodeImpl
- Returns:
- true if the node has the is-nilled property
-
isDefaultedAttribute
public boolean isDefaultedAttribute()
Ask whether the attribute results from expansion of attribute defaults- Returns:
- true if this attribute resulted from expansion of default or fixed values defined
in a schema. Note that this property will only be set if both the configuration properties
FeatureKeys.EXPAND_ATTRIBUTE_DEFAULTS
andFeatureKeys.MARK_DEFAULTED_ATTRIBUTES
are set.
-
hashCode
public 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()- Specified by:
hashCode
in interfaceNodeInfo
- Overrides:
hashCode
in classTinyNodeImpl
- Since:
- 8.7 Previously, the effect of the equals() and hashCode() methods was not defined. Callers should therefore be aware that third party implementations of the NodeInfo interface may not implement the correct semantics.
-
-