com.icl.saxon.tinytree

Class TinyElementImpl

final class TinyElementImpl extends TinyParentNodeImpl implements Element

A node in the XML parse tree representing an XML element.

This class is an implementation of NodeInfo and also implements the DOM Element interface

Author: Michael H. Kay

Constructor Summary
TinyElementImpl(TinyDocumentImpl doc, int nodeNr)
Constructor
Method Summary
voidcopy(Outputter out)
Copy this node to a given outputter (supporting xsl:copy-of)
voidcopy(Outputter out, boolean allNamespaces)
Copy this node to a given outputter
StringgetAttributeValue(String uri, String localName)
Find the value of a given attribute of this node.
StringgetAttributeValue(int fingerprint)
Get the value of a given attribute of this node
StringgetBaseURI()
Get the base URI of this element node.
shortgetNodeType()
Return the type of node.
booleanhasAttributes()
Returns whether this node (if it is an element) has any attributes.
TinyAttributeImplmakeAttributeNode(int index)
Make an attribute node for a given attribute of this element
voidoutputNamespaceNodes(Outputter out, boolean includeAncestors)
Output all namespace nodes associated with this element.
voidsetAttribute(String name, String value)
Set the value of an attribute on the current element.

Constructor Detail

TinyElementImpl

public TinyElementImpl(TinyDocumentImpl doc, int nodeNr)
Constructor

Method Detail

copy

public void copy(Outputter out)
Copy this node to a given outputter (supporting xsl:copy-of)

copy

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

Parameters: allNamespaces true if all namespace nodes must be copied; false if namespace nodes for the parent element are already on the result tree

getAttributeValue

public String getAttributeValue(String uri, String localName)
Find the value of a given attribute of this node.
This method is defined on all nodes to meet XSL requirements, but for nodes other than elements it will always return null.

Parameters: uri the namespace uri of an attribute localName the local name of an attribute

Returns: the value of the attribute, if it exists, otherwise null

getAttributeValue

public String getAttributeValue(int fingerprint)
Get the value of a given attribute of this node

Parameters: fingerprint The fingerprint of the attribute name

Returns: the attribute value if it exists or null if not

getBaseURI

public String getBaseURI()
Get the base URI of this element node. This will be the same as the System ID unless xml:base has been used.

getNodeType

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

Returns: NodeInfo.ELEMENT

hasAttributes

public boolean hasAttributes()
Returns whether this node (if it is an element) has any attributes.

Returns: true if this node has any attributes, false otherwise.

Since: DOM Level 2

makeAttributeNode

public TinyAttributeImpl makeAttributeNode(int index)
Make an attribute node for a given attribute of this element

Parameters: index The relative position of the attribute, counting from zero. This is trusted to be in range.

outputNamespaceNodes

public void outputNamespaceNodes(Outputter out, boolean includeAncestors)
Output all namespace nodes associated with this element.

Parameters: out The relevant outputter includeAncestors True if namespaces associated with ancestor elements must also be output; false if these are already known to be on the result tree.

setAttribute

public void setAttribute(String name, String value)
Set the value of an attribute on the current element. This affects subsequent calls of getAttribute() for that element.

Parameters: name The name of the attribute to be set. Any prefix is interpreted relative to the namespaces defined for this element. value The new value of the attribute. Set this to null to remove the attribute.