com.gargoylesoftware.htmlunit.javascript.host.xml
Class XMLDocument

java.lang.Object
  extended by net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
      extended by com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
          extended by com.gargoylesoftware.htmlunit.javascript.host.Node
              extended by com.gargoylesoftware.htmlunit.javascript.host.EventNode
                  extended by com.gargoylesoftware.htmlunit.javascript.host.Document
                      extended by com.gargoylesoftware.htmlunit.javascript.host.xml.XMLDocument
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 XMLDocument
extends Document

A JavaScript object for XMLDocument.

Version:
$Revision: 8947 $
Author:
Ahmed Ashour, Marc Guillemot, Sudhan Moghe, Ronald Brill, Chuck Dumont, Frank Danek
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.gargoylesoftware.htmlunit.javascript.host.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
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
XMLDocument()
          Creates a new instance.
XMLDocument(WebWindow enclosingWindow)
          Creates a new instance, with associated XmlPage.
 
Method Summary
 Object createCDATASection(String data)
          Creates a new createCDATASection.
 Object createProcessingInstruction(String target, String data)
          Creates a new ProcessingInstruction.
 boolean getAsync()
          Returns Whether or not to send the request to the server asynchronously.
 Object getElementById(String id)
          Returns the element with the specified ID, as long as it is an HTML element; null otherwise.
 HTMLCollection getElementsByTagName(String tagName)
          Returns all the descendant elements with the specified tag name.
protected  void initParentScope(DomNode domNode, SimpleScriptable scriptable)
          Initialize the parent scope of a newly created scriptable.
 boolean load(String xmlSource)
          Loads an XML document from the specified location.
 boolean loadXML(String strXML)
          Loads an XML document using the supplied string.
 SimpleScriptable makeScriptableFor(DomNode domNode)
          Builds a new the JavaScript object that corresponds to the specified object.
 void setAsync(boolean async)
          Sets the async attribute.
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Document
captureEvents, createAttribute, createComment, createDocumentFragment, createElement, createElementNS, createNSResolver, createTextNode, evaluate, getBoxObjectFor, getDefaultView, getDesignMode, getDoctype, getDocumentElement, getElementsByTagNameNS, getImplementation, getLocation, getPage, getReferrer, importNode, setDesignMode, setLocation, setWindow
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.EventNode
fireEvent, getOnblur, getOnclick, getOncontextmenu, getOndblclick, getOnerror, getOnfocus, getOnfocusin, getOnfocusout, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnpropertychange, getOnresize, setOnblur, setOnclick, setOncontextmenu, setOndblclick, setOnerror, setOnfocus, setOnfocusin, setOnfocusout, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnpropertychange, setOnresize
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Node
addEventListener, appendChild, asJavaScriptException, attachEvent, cloneNode, compareDocumentPosition, contains, detachEvent, executeEvent, fireEvent, fireEvent, getAttributes, getBaseName, getChildNodes, getEventHandler, getEventHandlerProp, getFirstChild, getJavaScriptNode, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentElement, getParentNode, getPrefix, getPreviousSibling, getTextContent, getXml, hasChildNodes, hasEventHandlers, insertBefore, insertBeforeImpl, isSameNode, normalize, removeChild, removeEventListener, replaceChild, setEventHandler, setEventHandlerProp, setNodeValue, setTextContent
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.SimpleScriptable
clone, defineFunctionProperties, defineProperty, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, isReadOnlySettable, setCaseSensitive, setDomNode, setDomNode, setHtmlElement, setParentScope
 
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

XMLDocument

public XMLDocument()
Creates a new instance. JavaScript objects must have a default constructor.


XMLDocument

public XMLDocument(WebWindow enclosingWindow)
Creates a new instance, with associated XmlPage.

Parameters:
enclosingWindow - the window
Method Detail

setAsync

public void setAsync(boolean async)
Sets the async attribute.

Parameters:
async - Whether or not to send the request to the server asynchronously

getAsync

public boolean getAsync()
Returns Whether or not to send the request to the server asynchronously.

Returns:
the async attribute

load

public boolean load(String xmlSource)
Loads an XML document from the specified location.

Parameters:
xmlSource - a string containing a URL that specifies the location of the XML file
Returns:
true if the load succeeded; false if the load failed

loadXML

public boolean loadXML(String strXML)
Loads an XML document using the supplied string.

Parameters:
strXML - A string containing the XML string to load into this XML document object This string can contain an entire XML document or a well-formed fragment.
Returns:
true if the load succeeded; false if the load failed

makeScriptableFor

public SimpleScriptable makeScriptableFor(DomNode domNode)
Builds a new the JavaScript object that corresponds to the specified object.

Overrides:
makeScriptableFor in class SimpleScriptable
Parameters:
domNode - the DOM node for which a JS object should be created
Returns:
the JavaScript object

initParentScope

protected void initParentScope(DomNode domNode,
                               SimpleScriptable scriptable)
Initialize the parent scope of a newly created scriptable.

Overrides:
initParentScope in class SimpleScriptable
Parameters:
domNode - the DOM node for the script object
scriptable - the script object to initialize

getElementsByTagName

public HTMLCollection getElementsByTagName(String tagName)
Returns all the descendant elements with the specified tag name.

Overrides:
getElementsByTagName in class Document
Parameters:
tagName - the name to search for
Returns:
all the descendant elements with the specified tag name

getElementById

public Object getElementById(String id)
Returns the element with the specified ID, as long as it is an HTML element; null otherwise.

Parameters:
id - the ID to search for
Returns:
the element with the specified ID, as long as it is an HTML element; null otherwise

createProcessingInstruction

public Object createProcessingInstruction(String target,
                                          String data)
Creates a new ProcessingInstruction.

Parameters:
target - the target
data - the data
Returns:
the new ProcessingInstruction

createCDATASection

public Object createCDATASection(String data)
Creates a new createCDATASection.

Parameters:
data - the data
Returns:
the new CDATASection


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