com.gargoylesoftware.htmlunit.xml
Class XmlElement

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.html.DomNode
      extended by com.gargoylesoftware.htmlunit.html.DomNamespaceNode
          extended by com.gargoylesoftware.htmlunit.xml.XmlElement
All Implemented Interfaces:
Serializable, Cloneable

public class XmlElement
extends DomNamespaceNode

An XML element.

Version:
$Revision: 2132 $
Author:
Ahmed Ashour
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.DomNode
DomNode.ChildIterator, DomNode.DescendantElementsIterator
 
Field Summary
static String ATTRIBUTE_NOT_DEFINED
          Constant meaning that the specified attribute was not defined.
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.DomNode
ATTRIBUTE_NODE, COMMENT_NODE, DOCUMENT_NODE, ELEMENT_NODE, PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED, TEXT_NODE
 
Constructor Summary
protected XmlElement(String namespaceURI, String qualifiedName, Page page, Map attributes)
          Create an instance of a DOM node that can have a namespace.
 
Method Summary
 Map getAttributes()
          Returns the map holding the attributes, keyed by name.
 String getAttributeValue(String attributeName)
          Return the value of the specified attribute or an empty string.
 String getNodeName()
          Get the name for the current node.
 short getNodeType()
          Get the type of the current node.
 String getTagName()
          Return the tag name of this element.
 void removeAttribute(String attributeName)
          Removes an attribute specified by name from this element.
 void removeAttributeNS(String namespaceURI, String localName)
          Removes an attribute specified by namespace and local name from this element.
 void setAttribute(String attributeName, String attributeValue)
          Set the value of the attribute specified by name.
 void setAttributeNS(String namespaceURI, String qualifiedName, String attributeValue)
          Set the value of the attribute specified by namespace and qualified name.
 void setAttributeValue(String attributeName, String attributeValue)
          Set the value of the specified attribute.
 void setAttributeValue(String namespaceURI, String qualifiedName, String attributeValue)
          Set the value of the specified attribute.
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNamespaceNode
getLocalName, getNamespaceURI, getPrefix, getQualifiedName, setPrefix
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNode
addDomChangeListener, addPropertyChangeListener, appendChild, appendDomChild, asText, asXml, cloneDomNode, cloneNode, fireNodeAdded, fireNodeDeleted, firePropertyChange, getAllHtmlChildElements, getByXPath, getChildIterator, getChildrenAsText, getEndColumnNumber, getEndLineNumber, getEventHandler, getFirstByXPath, getFirstChild, getFirstDomChild, getLastChild, getLastDomChild, getLog, getNativePage, getNextDomSibling, getNextSibling, getNodeValue, getPage, getParentDomNode, getParentNode, getPreviousDomSibling, getPreviousSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, hasAttributes, insertBefore, isAncestorOf, isRenderedVisible, isTrimmedText, notifyIncorrectness, onAddedToPage, onAllChildrenAddedToPage, printChildrenAsXml, printXml, reduceWhitespace, remove, removeAllChildren, removeDomChangeListener, removeEventHandler, removePropertyChangeListener, replace, setEventHandler, setEventHandler, setNextSibling, setNodeValue, setParentNode, setPreviousSibling, setReadyState, setScriptObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_NOT_DEFINED

public static final String ATTRIBUTE_NOT_DEFINED
Constant meaning that the specified attribute was not defined.

Constructor Detail

XmlElement

protected XmlElement(String namespaceURI,
                     String qualifiedName,
                     Page page,
                     Map attributes)
Create an instance of a DOM node that can have a namespace.

Parameters:
namespaceURI - the URI that identifies an XML namespace.
qualifiedName - The qualified name of the element type to instantiate.
page - The page that contains this element.
attributes - The attributes of this element.
Method Detail

getNodeType

public short getNodeType()
Get the type of the current node.

Specified by:
getNodeType in class DomNode
Returns:
The node type

getNodeName

public String getNodeName()
Description copied from class: DomNode
Get the name for the current node.

Specified by:
getNodeName in class DomNode
Returns:
The same value as returned by getTagName(),

getTagName

public String getTagName()
Return the tag name of this element.

Returns:
the tag name of this element.

getAttributeValue

public final String getAttributeValue(String attributeName)
Return the value of the specified attribute or an empty string. If the result is an empty string then it will be ATTRIBUTE_NOT_DEFINED

Parameters:
attributeName - the name of the attribute
Returns:
The value of the attribute or ATTRIBUTE_NOT_DEFINED

getAttributes

public Map getAttributes()
Returns the map holding the attributes, keyed by name.

Returns:
the attributes map.

setAttribute

public final void setAttribute(String attributeName,
                               String attributeValue)
Set the value of the attribute specified by name.

Parameters:
attributeName - the name of the attribute
attributeValue - The value of the attribute

setAttributeNS

public final void setAttributeNS(String namespaceURI,
                                 String qualifiedName,
                                 String attributeValue)
Set the value of the attribute specified by namespace and qualified name.

Parameters:
namespaceURI - the URI that identifies an XML namespace.
qualifiedName - The qualified name (prefix:local) of the attribute.
attributeValue - The value of the attribute

setAttributeValue

public final void setAttributeValue(String attributeName,
                                    String attributeValue)
Set the value of the specified attribute.

Parameters:
attributeName - the name of the attribute
attributeValue - The value of the attribute

setAttributeValue

public final void setAttributeValue(String namespaceURI,
                                    String qualifiedName,
                                    String attributeValue)
Set the value of the specified attribute.

Parameters:
namespaceURI - the URI that identifies an XML namespace.
qualifiedName - The qualified name of the attribute
attributeValue - The value of the attribute

removeAttribute

public final void removeAttribute(String attributeName)
Removes an attribute specified by name from this element.

Parameters:
attributeName - the attribute attributeName

removeAttributeNS

public final void removeAttributeNS(String namespaceURI,
                                    String localName)
Removes an attribute specified by namespace and local name from this element.

Parameters:
namespaceURI - the URI that identifies an XML namespace.
localName - The name within the namespace.


Copyright © 2002-2010 Gargoyle Software Inc.. All Rights Reserved.