org.castor.xmlctf.xmldiff.xml.nodes
Class Element

java.lang.Object
  extended by org.castor.xmlctf.xmldiff.xml.nodes.XMLNode
      extended by org.castor.xmlctf.xmldiff.xml.nodes.ParentNode
          extended by org.castor.xmlctf.xmldiff.xml.nodes.Element

public class Element
extends ParentNode

A representation of an Element XML node.

Since:
Castor 1.1
Version:
$Revision: 0000 $ $Date: 2007-01-11 00:00:00 -0600 (Thu, 11 Jan 2007) $
Author:
Edward Kuns

Field Summary
 
Fields inherited from class org.castor.xmlctf.xmldiff.xml.nodes.XMLNode
ATTRIBUTE, ELEMENT, PROCESSING_INSTRUCTION, ROOT, TEXT
 
Constructor Summary
Element(java.lang.String namespace, java.lang.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 Namespace to this Element.
 java.lang.String getAttribute(java.lang.String uri, java.lang.String localName)
          Returns the value of the named attribute, or null if the node has no such attribute.
 java.util.Iterator getAttributeIterator()
          Returns an Iterator over the List of Attributes.
 Location getLocation()
          Returns the location of this Element in the document.
 java.lang.String getNamespacePrefix(java.lang.String uri)
          Returns the namespace prefix associated with this namespace URI, as defined in the context of this node.
 java.lang.String getNamespaceURI(java.lang.String prefix)
          Returns the namespace URI associated with this namespace prefix, as defined in the context of this node.
 void setLocation(Location location)
          Sets the location of this Element in the document.
 
Methods inherited from class org.castor.xmlctf.xmldiff.xml.nodes.ParentNode
addChild, getChildIterator, getStringValue, hasChildNodes
 
Methods inherited from class org.castor.xmlctf.xmldiff.xml.nodes.XMLNode
getLocalName, getNamespaceURI, getNodeLocation, getNodeType, getParentNode, getRootNode, getXPath, setNamespace, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Element

public Element(java.lang.String namespace,
               java.lang.String localName)
Creates a new Element.

Parameters:
namespace - the namespace URI for this node. (May be null.)
localName - the localname of this node. (Cannot be null.)
Method Detail

getAttributeIterator

public java.util.Iterator getAttributeIterator()
Returns an Iterator over the List of Attributes.

Returns:
an Iterator over the List of Attributes.

getAttribute

public java.lang.String getAttribute(java.lang.String uri,
                                     java.lang.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.

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

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.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 an empty String if the prefix is defined and associated with no namespace.

Overrides:
getNamespaceURI in class XMLNode
Parameters:
prefix - The namespace prefix
Returns:
The namespace URI, or null.

getNamespacePrefix

public java.lang.String getNamespacePrefix(java.lang.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.

Parameters:
uri - The namespace URI
Returns:
The namespace prefix, or null

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 Namespace to this Element.

Parameters:
namespace - the Namespace to add

setLocation

public void setLocation(Location location)
Sets the location of this Element in the document.

Parameters:
location - the location of this Element in the document.

getLocation

public Location getLocation()
Returns the location of this Element in the document.

Returns:
the location of this Element in the document.


Intalio Inc. (C) 1999-2007. All rights reserved http://www.intalio.com