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, Document, Node

public class XmlPage
extends SgmlPage

A page that will be returned for response with content type "text/xml".

Version:
$Revision: 8931 $
Author:
Marc Guillemot, David K. Taylor, Ahmed Ashour, Frank Danek
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.gargoylesoftware.htmlunit.html.DomNode
DomNode.ChildIterator, DomNode.DescendantElementsIterator<T extends DomNode>
 
Field Summary
 
Fields inherited from class com.gargoylesoftware.htmlunit.html.DomNode
AS_TEXT_BLANK, AS_TEXT_BLOCK_SEPARATOR, AS_TEXT_NEW_LINE, AS_TEXT_TAB, PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED
 
Fields inherited from interface org.w3c.dom.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
 
Constructor Summary
XmlPage(Node node, WebWindow enclosingWindow)
          Creates an instance.
XmlPage(WebResponse webResponse, WebWindow enclosingWindow)
          Creates an instance.
XmlPage(WebResponse webResponse, WebWindow enclosingWindow, boolean ignoreSAXException)
          Creates an instance.
XmlPage(WebResponse webResponse, WebWindow enclosingWindow, boolean ignoreSAXException, boolean handleXHTMLAsHTML)
          Creates an instance.
 
Method Summary
 Node adoptNode(Node source)
           Not yet implemented.
 Attr createAttributeNS(String namespaceURI, String qualifiedName)
           Not yet implemented.
 DomCDataSection createCDATASection(String data)
          
 Comment createComment(String data)
           Not yet implemented.
 DocumentFragment createDocumentFragment()
           Not yet implemented.
 Element createElement(String tagName)
          Creates an element, the type of which depends on the specified tag name.
 Element createElementNS(String namespaceURI, String qualifiedName)
          Create a new Element with the given namespace and qualified name.
 EntityReference createEntityReference(String name)
           Not yet implemented.
 DomProcessingInstruction createProcessingInstruction(String target, String data)
          
 Text createTextNode(String data)
           Not yet implemented.
 DomElement createXmlElement(String tagName)
          Creates a new XML element with the given tag name.
 DomElement createXmlElementNS(String namespaceURI, String qualifiedName)
          Creates a new XML element with the given namespace and qualified name.
 String getContent()
          Returns the content of the page.
 String getDocumentURI()
           Not yet implemented.
 DOMConfiguration getDomConfig()
           Not yet implemented.
 Element getElementById(String elementId)
           Not yet implemented.
 NodeList getElementsByTagName(String tagname)
           Not yet implemented.
 NodeList getElementsByTagNameNS(String namespace, String name)
           Not yet implemented.
 DOMImplementation getImplementation()
           Not yet implemented.
 String getInputEncoding()
           Not yet implemented.
 String getPageEncoding()
          Returns the page encoding.
 boolean getStrictErrorChecking()
           Not yet implemented.
 Document getXmlDocument()
          Returns the DOM representation of the XML content.
 String getXmlEncoding()
           Not yet implemented.
 boolean getXmlStandalone()
           Not yet implemented.
 String getXmlVersion()
           Not yet implemented.
 boolean hasCaseSensitiveTagNames()
          Returns true if this page has case-sensitive tag names, false otherwise.
 Node importNode(Node importedNode, boolean deep)
           Not yet implemented.
 Node renameNode(Node n, String namespaceURI, String qualifiedName)
           Not yet implemented.
protected  void setDocumentType(DomDocumentType type)
          Sets the document type.
 void setDocumentURI(String documentURI)
           Not yet implemented.
 void setStrictErrorChecking(boolean strictErrorChecking)
           Not yet implemented.
 void setXmlStandalone(boolean xmlStandalone)
           Not yet implemented.
 void setXmlVersion(String xmlVersion)
           Not yet implemented.
 
Methods inherited from class com.gargoylesoftware.htmlunit.SgmlPage
asXml, cleanUp, clone, createAttribute, createDomDocumentFragment, getCanonicalXPath, getDoctype, getDocumentElement, getEnclosingWindow, getNodeName, getNodeType, getPage, getUrl, getWebClient, getWebResponse, initialize, isHtmlPage, normalizeDocument, setEnclosingWindow
 
Methods inherited from class com.gargoylesoftware.htmlunit.html.DomNode
addDomChangeListener, appendChild, asText, checkChildHierarchy, cloneNode, compareDocumentPosition, detach, fireNodeAdded, fireNodeDeleted, getAncestors, getAttributes, getBaseURI, getByXPath, getByXPath, getChildNodes, getChildren, getDescendants, getEndColumnNumber, getEndLineNumber, getFeature, getFirstByXPath, getFirstByXPath, getFirstChild, getHtmlElementDescendants, getHtmlPageOrNull, getIndex, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, getTextContent, getUserData, hasAttributes, hasChildNodes, hasFeature, insertBefore, insertBefore, isAncestorOf, isAncestorOfAny, isBlock, isDefaultNamespace, isDescendant, isDirectlyAttachedToPage, isDisplayed, isEqualNode, isSameNode, isSupported, isTrimmedText, lookupNamespaceURI, lookupPrefix, mayBeDisplayed, normalize, notifyIncorrectness, onAddedToDocumentFragment, onAddedToPage, onAllChildrenAddedToPage, printChildrenAsXml, printXml, processImportNode, querySelector, querySelectorAll, remove, removeAllChildren, removeChild, removeDomChangeListener, replace, replaceChild, setNextSibling, setNodeValue, setParentNode, setPrefix, setPreviousSibling, setReadyState, setScriptObject, setTextContent, setUserData
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Constructor Detail

XmlPage

public XmlPage(WebResponse webResponse,
               WebWindow enclosingWindow)
        throws IOException
Creates 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)
Creates 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
Creates 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

XmlPage

public XmlPage(WebResponse webResponse,
               WebWindow enclosingWindow,
               boolean ignoreSAXException,
               boolean handleXHTMLAsHTML)
        throws IOException
Creates 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
handleXHTMLAsHTML - if true elements from the XHTML namespace are handled as HTML elements instead of DOM elements
Throws:
IOException - if the page could not be created
Method Detail

hasCaseSensitiveTagNames

public boolean hasCaseSensitiveTagNames()
Returns true if this page has case-sensitive tag names, false otherwise. In general, XML has case-sensitive tag names, and HTML doesn't. This is especially important during XPath matching.

Specified by:
hasCaseSensitiveTagNames in class SgmlPage
Returns:
true if this page has case-sensitive tag names, false otherwise

getContent

public String getContent()
Returns the content of the page.

Returns:
the content of the page

getXmlDocument

public Document getXmlDocument()
Returns the DOM representation of the XML content.

Returns:
null if the content couldn't be parsed

createXmlElement

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

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

createXmlElementNS

public DomElement createXmlElementNS(String namespaceURI,
                                     String qualifiedName)
Creates a new XML element 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 XML element

adoptNode

public Node adoptNode(Node source)
Not yet implemented.


createAttributeNS

public Attr createAttributeNS(String namespaceURI,
                              String qualifiedName)
Not yet implemented.


createCDATASection

public DomCDataSection createCDATASection(String data)


createComment

public Comment createComment(String data)
Not yet implemented.


createDocumentFragment

public DocumentFragment createDocumentFragment()
Not yet implemented.


createElement

public Element createElement(String tagName)
Creates an element, the type of which depends on the specified tag name.

Specified by:
createElement in interface Document
Specified by:
createElement in class SgmlPage
Parameters:
tagName - the tag name which determines the type of element to be created
Returns:
an element, the type of which depends on the specified tag name

createElementNS

public Element createElementNS(String namespaceURI,
                               String qualifiedName)
Create a new Element with the given namespace and qualified name. Not yet implemented.

Specified by:
createElementNS in interface Document
Specified by:
createElementNS in class SgmlPage
Parameters:
namespaceURI - the URI that identifies an XML namespace
qualifiedName - the qualified name of the element type to instantiate
Returns:
the new element

createEntityReference

public EntityReference createEntityReference(String name)
Not yet implemented.


createProcessingInstruction

public DomProcessingInstruction createProcessingInstruction(String target,
                                                            String data)


createTextNode

public Text createTextNode(String data)
Not yet implemented.


getDocumentURI

public String getDocumentURI()
Not yet implemented.


getDomConfig

public DOMConfiguration getDomConfig()
Not yet implemented.


getElementById

public Element getElementById(String elementId)
Not yet implemented.


getElementsByTagName

public NodeList getElementsByTagName(String tagname)
Not yet implemented.


getElementsByTagNameNS

public NodeList getElementsByTagNameNS(String namespace,
                                       String name)
Not yet implemented.


getImplementation

public DOMImplementation getImplementation()
Not yet implemented.


getInputEncoding

public String getInputEncoding()
Not yet implemented.


getStrictErrorChecking

public boolean getStrictErrorChecking()
Not yet implemented.


getXmlEncoding

public String getXmlEncoding()
Not yet implemented.


getXmlStandalone

public boolean getXmlStandalone()
Not yet implemented.


getXmlVersion

public String getXmlVersion()
Not yet implemented.


importNode

public Node importNode(Node importedNode,
                       boolean deep)
Not yet implemented.


renameNode

public Node renameNode(Node n,
                       String namespaceURI,
                       String qualifiedName)
Not yet implemented.


setDocumentURI

public void setDocumentURI(String documentURI)
Not yet implemented.


setStrictErrorChecking

public void setStrictErrorChecking(boolean strictErrorChecking)
Not yet implemented.


setXmlStandalone

public void setXmlStandalone(boolean xmlStandalone)
Not yet implemented.


setXmlVersion

public void setXmlVersion(String xmlVersion)
Not yet implemented.


getPageEncoding

public String getPageEncoding()
Returns the page encoding. Not yet implemented.

Specified by:
getPageEncoding in class SgmlPage
Returns:
the page encoding

setDocumentType

protected void setDocumentType(DomDocumentType type)
Sets the document type.

Overrides:
setDocumentType in class SgmlPage
Parameters:
type - the document type


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