org.exolab.adaptx.xslt.dom

Class Element

Implemented Interfaces:
java.io.Serializable

public class Element
extends org.exolab.adaptx.xslt.dom.ParentNode

A representation of an Element node
Version:
$Revision: 3633 $ $Date: 2003-03-01 02:38:44 -0500 (Sat, 01 Mar 2003) $
Author:
Keith Visco
See Also:
Serialized Form

Field Summary

Fields inherited from class org.exolab.adaptx.xslt.dom.BaseNode

LOCATION_PROPERTY

Fields inherited from class org.exolab.adaptx.xpath.XPathNode

ATTRIBUTE, COMMENT, ELEMENT, NAMESPACE, PI, ROOT, TEXT

Constructor Summary

Element(String namespace, String localName)
Creates a new Element

Method Summary

void
addAttribute(Attribute attr)
Adds the given Attribute to this Element
void
addNamespace(Namespace namespace)
Adds the given Attribute to this Element
String
getAttribute(String uri, String localName)
Returns the value of the named attribute, or null if the node has no such attribute.
XPathNode
getFirstAttribute()
Returns the first in a list of attribute nodes, or null if the node has no attributes.
XPathNode
getFirstNamespace()
Returns the first in a list of namespace nodes, or null if the node has no namespaces.
String
getNamespacePrefix(String uri)
Returns the namespace prefix associated with this namespace URI, as defined in the context of this node.
String
getNamespaceURI(String prefix)
Returns the namespace URI associated with this namespace prefix, as defined in the context of this node.
int
getNodeType()
Returns the type of this node.

Methods inherited from class org.exolab.adaptx.xslt.dom.ParentNode

addChild, getFirstChild, getStringValue, hasChildNodes

Methods inherited from class org.exolab.adaptx.xslt.dom.BaseNode

getAttribute, getFirstAttribute, getFirstChild, getFirstNamespace, getLocalName, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNext, getNodeType, getParentNode, getPrevious, getProperty, getRootNode, getStringValue, hasChildNodes, setProperty

Methods inherited from class org.exolab.adaptx.xpath.XPathNode

getAttribute, getFirstAttribute, getFirstChild, getFirstNamespace, getLocalName, getNamespacePrefix, getNamespaceURI, getNamespaceURI, getNext, getNodeType, getParentNode, getPrevious, getRootNode, getStringValue, hasChildNodes

Constructor Details

Element

public Element(String namespace,
               String localName)
Creates a new Element
Parameters:
namespace - the namespace URI for this node. [May be null]
localName - the local-name of this node. [Cannot be null]

Method Details

addAttribute

public void addAttribute(Attribute attr)
Adds the given Attribute to this Element
Parameters:
attr - the Attribute to add

addNamespace

public void addNamespace(Namespace namespace)
Adds the given Attribute to this Element
Parameters:

getAttribute

public String getAttribute(String uri,
                           String localName)
Returns the value of the named attribute, or null if the node has no such attribute. If the argument uri is null, the node's namespace URI will be used. This method is valid only for the element node.
Overrides:
getAttribute in interface org.exolab.adaptx.xslt.dom.BaseNode
Parameters:
uri - The attribute's namespace URI, or null
localName - The attribute's local name
Returns:
The attribute's value, or null if no such attribute exists

getFirstAttribute

public XPathNode getFirstAttribute()
Returns the first in a list of attribute nodes, or null if the node has no attributes. This method is valid only for the element node.
Overrides:
getFirstAttribute in interface org.exolab.adaptx.xslt.dom.BaseNode
Returns:
The first in a list of attribute nodes, or null

getFirstNamespace

public XPathNode getFirstNamespace()
Returns the first in a list of namespace nodes, or null if the node has no namespaces. This method is valid only for the element node.
Overrides:
getFirstNamespace in interface org.exolab.adaptx.xslt.dom.BaseNode
Returns:
The first in a list of namespace nodes, or null

getNamespacePrefix

public String getNamespacePrefix(String uri)
Returns the namespace prefix associated with this namespace URI, as defined in the context of this node. Returns null if no prefix is defined for this namespace URI. Returns an empty string if the default prefix is associated with this namespace URI. This method is valid only for element nodes.
Overrides:
getNamespacePrefix in interface org.exolab.adaptx.xslt.dom.BaseNode
Parameters:
uri - The namespace URI
Returns:
The namespace prefix, or null

getNamespaceURI

public String getNamespaceURI(String prefix)
Returns the namespace URI associated with this namespace prefix, as defined in the context of this node. Returns null if the prefix is undefined. Returns empty if the prefix is defined and associated with no namespace. This method is valid only for element nodes.
Overrides:
getNamespaceURI in interface org.exolab.adaptx.xslt.dom.BaseNode
Parameters:
prefix - The namespace prefix
Returns:
The namespace URI, or null

getNodeType

public int getNodeType()
Returns the type of this node.
Overrides:
getNodeType in interface org.exolab.adaptx.xslt.dom.BaseNode
Returns:
The type of this node