com.gargoylesoftware.htmlunit.activex.javascript.msxml
Class XMLDOMElement

java.lang.Object
  extended by net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLScriptable
              extended by com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMNode
                  extended by com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMElement
All Implemented Interfaces:
Serializable, Cloneable, net.sourceforge.htmlunit.corejs.javascript.ConstProperties, net.sourceforge.htmlunit.corejs.javascript.debug.DebuggableObject, net.sourceforge.htmlunit.corejs.javascript.Scriptable

public class XMLDOMElement
extends XMLDOMNode

A JavaScript object for MSXML's (ActiveX) XMLDOMElement.
Represents the element object.

Version:
$Revision: 9024 $
Author:
Ahmed Ashour, Marc Guillemot, Sudhan Moghe, Ronald Brill, Frank Danek
See Also:
MSDN documentation, Serialized Form

Field Summary
 
Fields inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface net.sourceforge.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
XMLDOMElement()
          Creates an instance.
 
Method Summary
protected  XMLDOMNamedNodeMap createAttributesObject()
          Creates the JS object for the property attributes.
 Object getAttribute(String name)
          Returns the value of the attribute.
 Object getAttributeNode(String name)
          Returns the attribute node.
 Object getAttributes()
          Returns the list of attributes for this element.
 DomElement getDomNodeOrDie()
          Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.
 XMLDOMNodeList getElementsByTagName(String tagName)
          Returns a list of all descendant elements that match the supplied name.
 String getTagName()
          Returns the element name.
 String getText()
          Returns a string that represents the element content.
 void normalize()
          Normalizes all descendant elements by combining two or more adjacent text nodes into one unified text node.
 void removeAttribute(String name)
          Removes the named attribute.
 XMLDOMAttribute removeAttributeNode(XMLDOMAttribute att)
          Removes the specified attribute from this element.
 void setAttribute(String name, String value)
          Sets the value of the named attribute.
 XMLDOMAttribute setAttributeNode(XMLDOMAttribute newAtt)
          Sets or updates the supplied attribute node on this element.
 void setNodeValue(String newValue)
          Attempting to set the value of elements generates an error.
 void setText(Object value)
          Replaces all children of this element with the supplied value.
 
Methods inherited from class com.gargoylesoftware.htmlunit.activex.javascript.msxml.XMLDOMNode
appendChild, cloneNode, getBaseName, getChildNodes, getDataType, getDefinition, getFirstChild, getJavaScriptNode, getLastChild, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getXml, hasChildNodes, insertBefore, insertBeforeImpl, removeChild, replaceChild, selectNodes, selectSingleNode
 
Methods inherited from class com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLScriptable
getClassName, getEnvironment, getPrototype, makeScriptableFor, setEnvironment, setParentScope
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
clone, defineFunctionProperties, defineProperty, equivalentValues, get, getBrowserVersion, getDefaultValue, getDomNodeOrNull, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, setCaseSensitive, setDomNode, setDomNode, setHtmlElement
 
Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setPrototype, size
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLDOMElement

public XMLDOMElement()
Creates an instance. JavaScript objects must have a default constructor.

Method Detail

getAttributes

public Object getAttributes()
Returns the list of attributes for this element.

Overrides:
getAttributes in class XMLDOMNode
Returns:
the list of attributes for this element

createAttributesObject

protected XMLDOMNamedNodeMap createAttributesObject()
Creates the JS object for the property attributes. This object will the be cached.

Returns:
the JS object

setNodeValue

public void setNodeValue(String newValue)
Attempting to set the value of elements generates an error.

Overrides:
setNodeValue in class XMLDOMNode
Parameters:
newValue - the new value to set

getTagName

public String getTagName()
Returns the element name.

Returns:
the element name

getText

public String getText()
Returns a string that represents the element content. This will also include the text content from all child elements, concatenated in document order.

Overrides:
getText in class XMLDOMNode
Returns:
a string that represents the element content

setText

public void setText(Object value)
Replaces all children of this element with the supplied value.

Overrides:
setText in class XMLDOMNode
Parameters:
value - the new value for the contents of this node

getAttribute

public Object getAttribute(String name)
Returns the value of the attribute.

Parameters:
name - the name of the attribute to return
Returns:
the value of the specified attribute, null if the named attribute does not have a specified value

getAttributeNode

public Object getAttributeNode(String name)
Returns the attribute node.

Parameters:
name - the name of the attribute to return
Returns:
the attribute node with the supplied name, null if the named attribute cannot be found on this element

removeAttribute

public void removeAttribute(String name)
Removes the named attribute.

Parameters:
name - the name of the attribute to be removed

removeAttributeNode

public XMLDOMAttribute removeAttributeNode(XMLDOMAttribute att)
Removes the specified attribute from this element.

Parameters:
att - the attribute to be removed from this element
Returns:
the removed attribute

setAttribute

public void setAttribute(String name,
                         String value)
Sets the value of the named attribute.

Parameters:
name - the name of the attribute; if the attribute with that name already exists, its value is changed
value - the value for the named attribute

setAttributeNode

public XMLDOMAttribute setAttributeNode(XMLDOMAttribute newAtt)
Sets or updates the supplied attribute node on this element.

Parameters:
newAtt - the attribute node to be associated with this element
Returns:
the replaced attribute node, if any, null otherwise

getElementsByTagName

public XMLDOMNodeList getElementsByTagName(String tagName)
Returns a list of all descendant elements that match the supplied name.

Parameters:
tagName - the name of the element to find; the tagName value '*' matches all descendant elements of this element
Returns:
a list containing all elements that match the supplied name

normalize

public void normalize()
Normalizes all descendant elements by combining two or more adjacent text nodes into one unified text node.


getDomNodeOrDie

public DomElement getDomNodeOrDie()
Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.

Overrides:
getDomNodeOrDie in class SimpleScriptable
Returns:
the DOM node


Copyright © 2002–2014 Gargoyle Software Inc.. All rights reserved.