org.apache.webdav.lib.util
Class DOMUtils

java.lang.Object
  extended byorg.apache.webdav.lib.util.DOMUtils

public class DOMUtils
extends java.lang.Object

This class provides some basic utility methods for working with XML Document objects. Many of these utilities provide JAXP 1.0 "brute force" implementations of functions that are available in JAXP 1.1.

Version:
$Revision: 1.3 $

Nested Class Summary
(package private) static class DOMUtils.NodeListImpl
          This class provides an implementation of NodeList, which is used by the getElementsByTagNameNS() method.
 
Field Summary
protected static java.lang.Class[] getElementsByNSParameterTypes
           
 
Constructor Summary
DOMUtils()
           
 
Method Summary
static java.lang.String findDavPrefix(org.w3c.dom.Document document)
          Deprecated.  
protected static void getChildElementsByTagNameNS(java.util.Vector vector, org.w3c.dom.Node node, java.lang.String tagName, java.lang.String namespace)
           
static java.lang.String getElementLocalName(org.w3c.dom.Element element)
           
static java.lang.String getElementNamespaceURI(org.w3c.dom.Element element)
           
static org.w3c.dom.NodeList getElementsByTagNameNS(org.w3c.dom.Node node, java.lang.String tagName, java.lang.String namespace)
           
static org.w3c.dom.Element getFirstElement(org.w3c.dom.Node node, java.lang.String namespace, java.lang.String name)
          Get the first element matched with the given namespace and name.
static java.lang.String getTextValue(org.w3c.dom.Node node)
          Recursively scans all child elements, appending any text nodes.
static int parseStatus(java.lang.String statusString)
          Get the status code out of the normal status response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

getElementsByNSParameterTypes

protected static java.lang.Class[] getElementsByNSParameterTypes
Constructor Detail

DOMUtils

public DOMUtils()
Method Detail

findDavPrefix

public static java.lang.String findDavPrefix(org.w3c.dom.Document document)
Deprecated.  

Determine the namespace prefix being used for DAV. Generally, DAV responses say something like:
  <D:multistatus xmlns:D="DAV:">
  

In this case, the "D:" is the prefix for DAV.


getTextValue

public static java.lang.String getTextValue(org.w3c.dom.Node node)
Recursively scans all child elements, appending any text nodes.
  <customer>Joe Schmoe</customer>
  

In this case, calling this method on the customer element returns "Joe Schmoe".


parseStatus

public static int parseStatus(java.lang.String statusString)
Get the status code out of the normal status response.

Each DAV:propstat node contains a status line, such as:

  <DAV:status>HTTP/1.1 200 OK</DAV:status>
  

In this case, calling this method on the text string returns 200.


getElementNamespaceURI

public static java.lang.String getElementNamespaceURI(org.w3c.dom.Element element)

getElementLocalName

public static java.lang.String getElementLocalName(org.w3c.dom.Element element)

getElementsByTagNameNS

public static org.w3c.dom.NodeList getElementsByTagNameNS(org.w3c.dom.Node node,
                                                          java.lang.String tagName,
                                                          java.lang.String namespace)

getChildElementsByTagNameNS

protected static void getChildElementsByTagNameNS(java.util.Vector vector,
                                                  org.w3c.dom.Node node,
                                                  java.lang.String tagName,
                                                  java.lang.String namespace)

getFirstElement

public static org.w3c.dom.Element getFirstElement(org.w3c.dom.Node node,
                                                  java.lang.String namespace,
                                                  java.lang.String name)
Get the first element matched with the given namespace and name.

Parameters:
node - The node.
name - The name.
Returns:
The wanted first element.