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: 6760 $
Author:
Ahmed Ashour, Marc Guillemot, Sudhan Moghe, Ronald Brill
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
protected  void initParentScope(DomNode domNode, SimpleScriptable scriptable)
          Initialize the parent scope of a newly created scriptable.
 Object jsxFunction_createCDATASection(String data)
          Creates a new createCDATASection.
 Object jsxFunction_createNode(Object type, String name, Object namespaceURI)
          Creates a node using the supplied type, name, and namespace.
 Object jsxFunction_createProcessingInstruction(String target, String data)
          Creates a new ProcessingInstruction.
 Object jsxFunction_getElementById(String id)
          Returns the element with the specified ID, as long as it is an HTML element; null otherwise.
 HTMLCollection jsxFunction_getElementsByTagName(String tagName)
          Returns all the descendant elements with the specified tag name.
 boolean jsxFunction_load(String xmlSource)
          Loads an XML document from the specified location.
 boolean jsxFunction_loadXML(String strXML)
          Loads an XML document using the supplied string.
 Object jsxFunction_nodeFromID(String id)
          Since we are not processing DTD, this method always returns null.
 HTMLCollection jsxFunction_selectNodes(String expression)
          Applies the specified XPath expression to this node's context and returns the generated list of matching nodes.
 Object jsxFunction_selectSingleNode(String expression)
          Applies the specified pattern-matching operation to this node's context and returns the first matching node.
 void jsxFunction_setProperty(String name, String value)
          This method is used to set second-level properties on the DOM object.
 boolean jsxGet_async()
          Returns Whether or not to send the request to the server asynchronously.
 XMLDOMParseError jsxGet_parseError()
          Gets the JavaScript property "parseError" for the document.
 boolean jsxGet_preserveWhiteSpace()
          Gets the current white space handling.
 String jsxGet_xml()
          Contains the XML representation of the node and all its descendants.
 void jsxSet_async(boolean async)
          Sets the async attribute.
 void jsxSet_preserveWhiteSpace(boolean preserveWhiteSpace)
          Specifies the white space handling.
 SimpleScriptable makeScriptableFor(DomNode domNode)
          Builds a new the JavaScript object that corresponds to the specified object.
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Document
getPage, jsxFunction_captureEvents, jsxFunction_createAttribute, jsxFunction_createComment, jsxFunction_createDocumentFragment, jsxFunction_createElement, jsxFunction_createElementNS, jsxFunction_createNSResolver, jsxFunction_createTextNode, jsxFunction_evaluate, jsxFunction_getBoxObjectFor, jsxFunction_getElementsByTagNameNS, jsxFunction_importNode, jsxGet_defaultView, jsxGet_designMode, jsxGet_doctype, jsxGet_documentElement, jsxGet_implementation, jsxGet_location, jsxGet_referrer, jsxSet_designMode, jsxSet_location, setWindow
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.EventNode
jsxFunction_fireEvent, jsxGet_onblur, jsxGet_onclick, jsxGet_oncontextmenu, jsxGet_ondblclick, jsxGet_onerror, jsxGet_onfocus, jsxGet_onfocusin, jsxGet_onfocusout, jsxGet_onkeydown, jsxGet_onkeypress, jsxGet_onkeyup, jsxGet_onmousedown, jsxGet_onmousemove, jsxGet_onmouseout, jsxGet_onmouseover, jsxGet_onmouseup, jsxGet_onpropertychange, jsxGet_onresize, jsxSet_onblur, jsxSet_onclick, jsxSet_oncontextmenu, jsxSet_ondblclick, jsxSet_onerror, jsxSet_onfocus, jsxSet_onfocusin, jsxSet_onfocusout, jsxSet_onkeydown, jsxSet_onkeypress, jsxSet_onkeyup, jsxSet_onmousedown, jsxSet_onmousemove, jsxSet_onmouseout, jsxSet_onmouseover, jsxSet_onmouseup, jsxSet_onpropertychange, jsxSet_onresize
 
Methods inherited from class com.gargoylesoftware.htmlunit.javascript.host.Node
executeEvent, fireEvent, getEventHandler, getEventHandlerProp, getJavaScriptNode, getParent, hasEventHandlers, jsxFunction_addEventListener, jsxFunction_appendChild, jsxFunction_attachEvent, jsxFunction_cloneNode, jsxFunction_compareDocumentPosition, jsxFunction_detachEvent, jsxFunction_hasChildNodes, jsxFunction_insertBefore, jsxFunction_insertBefore, jsxFunction_isSameNode, jsxFunction_normalize, jsxFunction_removeChild, jsxFunction_removeEventListener, jsxFunction_replaceChild, jsxGet_childNodes, jsxGet_firstChild, jsxGet_innerText, jsxGet_lastChild, jsxGet_localName, jsxGet_namespaceURI, jsxGet_nextSibling, jsxGet_nodeName, jsxGet_nodeType, jsxGet_nodeValue, jsxGet_ownerDocument, jsxGet_parentNode, jsxGet_prefix, jsxGet_previousSibling, jsxGet_textContent, jsxSet_innerText, jsxSet_nodeValue, jsxSet_textContent, setDomNode, setEventHandler, setEventHandlerProp
 
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, setCaseSensitive, setDomNode, setHtmlElement
 
Methods inherited from class net.sourceforge.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, 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, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, 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

jsxSet_async

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

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

jsxGet_async

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

Returns:
the async attribute

jsxFunction_load

public boolean jsxFunction_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

jsxFunction_loadXML

public boolean jsxFunction_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

jsxGet_parseError

public XMLDOMParseError jsxGet_parseError()
Gets the JavaScript property "parseError" for the document.

Returns:
the ParserError object for the document

jsxGet_xml

public String jsxGet_xml()
Contains the XML representation of the node and all its descendants.

Overrides:
jsxGet_xml in class Node
Returns:
an XML representation of this node and all its descendants

jsxGet_preserveWhiteSpace

public boolean jsxGet_preserveWhiteSpace()
Gets the current white space handling.

Returns:
the current white space handling

jsxSet_preserveWhiteSpace

public void jsxSet_preserveWhiteSpace(boolean preserveWhiteSpace)
Specifies the white space handling.

Parameters:
preserveWhiteSpace - white space handling

jsxFunction_setProperty

public void jsxFunction_setProperty(String name,
                                    String value)
This method is used to set second-level properties on the DOM object.

Parameters:
name - the name of the property to be set
value - the value of the specified property

jsxFunction_selectNodes

public HTMLCollection jsxFunction_selectNodes(String expression)
Applies the specified XPath expression to this node's context and returns the generated list of matching nodes.

Parameters:
expression - a string specifying an XPath expression
Returns:
list of the found elements

jsxFunction_selectSingleNode

public Object jsxFunction_selectSingleNode(String expression)
Applies the specified pattern-matching operation to this node's context and returns the first matching node.

Parameters:
expression - a string specifying an XPath expression
Returns:
the first node that matches the given pattern-matching operation If no nodes match the expression, returns a null value.

jsxFunction_getElementsByTagName

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

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

jsxFunction_getElementById

public Object jsxFunction_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

jsxFunction_nodeFromID

public Object jsxFunction_nodeFromID(String id)
Since we are not processing DTD, this method always returns null.

Parameters:
id - the ID to search for
Returns:
null

jsxFunction_createProcessingInstruction

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

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

jsxFunction_createCDATASection

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

Parameters:
data - the data
Returns:
the new CDATASection

jsxFunction_createNode

public Object jsxFunction_createNode(Object type,
                                     String name,
                                     Object namespaceURI)
Creates a node using the supplied type, name, and namespace.

Parameters:
type - a value that uniquely identifies the node type
name - the value for the new node's nodeName property
namespaceURI - A string defining the namespace URI. If specified, the node is created in the context of the namespaceURI parameter with the prefix specified on the node name. If the name parameter does not have a prefix, this is treated as the default namespace.
Returns:
the newly created node


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