com.gargoylesoftware.htmlunit.xml
Class XmlPage

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.html.DomNode
      extended by com.gargoylesoftware.htmlunit.SgmlPage
          extended by com.gargoylesoftware.htmlunit.xml.XmlPage
All Implemented Interfaces:
Page, Serializable, Cloneable

public class XmlPage
extends SgmlPage

A page that will be returned for response with content type "text/xml". It doesn't implement itself Document to allow to see the source of badly formed xml responses.

Version:
$Revision: 2132 $
Author:
Marc Guillemot, David K. Taylor, 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
 
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
XmlPage(Node node, WebWindow enclosingWindow)
          Create an instance.
XmlPage(WebResponse webResponse, WebWindow enclosingWindow)
          Create an instance.
XmlPage(WebResponse webResponse, WebWindow enclosingWindow, boolean ignoreSAXException)
          Create an instance.
 
Method Summary
 void cleanUp()
          Clean up this page.
 XmlElement createXmlElement(String tagName)
          Create a new XML element with the given tag name.
 XmlElement createXmlElementNS(String namespaceURI, String qualifiedName)
          Create a new HtmlElement with the given namespace and qualified name.
 String getContent()
          Return the content of the page
 XmlElement getDocumentXmlElement()
          Get the root XmlElement of this document.
 Document getXmlDocument()
          Gets the DOM representation of the xml content
 void setScriptObject(org.mozilla.javascript.ScriptableObject scriptObject)
          INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Set the javascript object that corresponds to this node.
 
Methods inherited from class com.gargoylesoftware.htmlunit.SgmlPage
createDomDocumentFragment, getEnclosingWindow, getNativePage, getNodeName, getNodeType, getWebClient, getWebResponse, initialize, setEnclosingWindow
 
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, getLocalName, getLog, getNamespaceURI, getNextDomSibling, getNextSibling, getNodeValue, getPage, getParentDomNode, getParentNode, getPrefix, 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, setPrefix, setPreviousSibling, setReadyState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlPage

public XmlPage(WebResponse webResponse,
               WebWindow enclosingWindow)
        throws IOException
Create an instance. A warning is logged if an exception is thrown while parsing the xml content (for instance when the content is not a valid xml and can't be parsed).

Parameters:
webResponse - The response from the server
enclosingWindow - The window that holds the page.
Throws:
IOException - If the page could not be created

XmlPage

public XmlPage(Node node,
               WebWindow enclosingWindow)
Create an instance. A warning is logged if an exception is thrown while parsing the xml content (for instance when the content is not a valid xml and can't be parsed).

Parameters:
node - The node to initialize this page with.
enclosingWindow - The window that holds the page.

XmlPage

public XmlPage(WebResponse webResponse,
               WebWindow enclosingWindow,
               boolean ignoreSAXException)
        throws IOException
Create an instance. A warning is logged if an exception is thrown while parsing the xml content (for instance when the content is not a valid xml and can't be parsed).

Parameters:
webResponse - The response from the server
enclosingWindow - The window that holds the page.
ignoreSAXException - Whether to ignore SAXException or throw it as IOException.
Throws:
IOException - If the page could not be created
Method Detail

setScriptObject

public void setScriptObject(org.mozilla.javascript.ScriptableObject scriptObject)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Set the javascript object that corresponds to this node. This is not guaranteed to be set even if there is a javascript object for this DOM node.

Overrides:
setScriptObject in class DomNode
Parameters:
scriptObject - The javascript object.

cleanUp

public void cleanUp()
Clean up this page.

Specified by:
cleanUp in interface Page
Overrides:
cleanUp in class SgmlPage

getContent

public String getContent()
Return the content of the page

Returns:
See above

getXmlDocument

public Document getXmlDocument()
Gets the DOM representation of the xml content

Returns:
null if the content couldn't be parsed.

getDocumentXmlElement

public XmlElement getDocumentXmlElement()
Get the root XmlElement of this document.

Returns:
The root element

createXmlElement

public XmlElement createXmlElement(String tagName)
Create a new XML element with the given tag name.

Parameters:
tagName - The tag name.
Returns:
the new XML element.

createXmlElementNS

public XmlElement createXmlElementNS(String namespaceURI,
                                     String qualifiedName)
Create a new HtmlElement with the given namespace and qualified name.

Parameters:
namespaceURI - the URI that identifies an XML namespace.
qualifiedName - The qualified name of the element type to instantiate
Returns:
the new HTML element.


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