com.gargoylesoftware.htmlunit.xml
Class XmlUtil

java.lang.Object
  extended by com.gargoylesoftware.htmlunit.xml.XmlUtil

public final class XmlUtil
extends Object

INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Provides facility method to work with xml responses.

Version:
$Revision: 2132 $
Author:
Marc Guillemot, Ahmed Ashour

Method Summary
static void appendChild(Page page, DomNode parent, Node child)
          Recursively appends a Node child to DomNode parent.
static Document buildDocument(WebResponse webResponse)
          Builds a document from the content of the webresponse.
protected static Log getLog()
          Return the log object for this web client
static String lookupNamespaceURI(HtmlElement element, String prefix)
          Search for the namespace URI of the given prefix, starting from the specified element.
static String lookupNamespaceURI(XmlElement element, String prefix)
          Search for the namespace URI of the given prefix, starting from the specified element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

buildDocument

public static Document buildDocument(WebResponse webResponse)
                              throws IOException,
                                     SAXException,
                                     ParserConfigurationException
Builds a document from the content of the webresponse. 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
Returns:
the parse result
Throws:
IOException - If the page could not be created
SAXException - if the parsing fails
ParserConfigurationException - if a DocumentBuilder cannot be created

getLog

protected static Log getLog()
Return the log object for this web client

Returns:
The log object

appendChild

public static void appendChild(Page page,
                               DomNode parent,
                               Node child)
Recursively appends a Node child to DomNode parent.

Parameters:
page - the owner page of XmlElements to be created.
parent - the parent DomNode.
child - the child Node.

lookupNamespaceURI

public static String lookupNamespaceURI(XmlElement element,
                                        String prefix)
Search for the namespace URI of the given prefix, starting from the specified element.

Parameters:
element - The element to start searching from.
prefix - The namespace prefix.
Returns:
the namespace URI bound to the prefix; or null if there is no such namespace.
See Also:
lookupNamespaceURI(HtmlElement, String)

lookupNamespaceURI

public static String lookupNamespaceURI(HtmlElement element,
                                        String prefix)
Search for the namespace URI of the given prefix, starting from the specified element.

Parameters:
element - The element to start searching from.
prefix - The namespace prefix.
Returns:
the namespace URI bound to the prefix; or null if there is no such namespace.
See Also:
lookupNamespaceURI(XmlElement, String)


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