org.globus.wsrf.utils
Class XmlUtils

java.lang.Object
  extended byorg.globus.wsrf.utils.XmlUtils

public class XmlUtils
extends Object


Field Summary
private static javax.xml.parsers.DocumentBuilderFactory dbf
           
private static org.apache.commons.logging.Log log
           
 
Constructor Summary
XmlUtils()
           
 
Method Summary
private static javax.xml.parsers.DocumentBuilderFactory getDOMFactory()
           
static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Element element)
          Utility function for getting the first child element from a element
private static org.xml.sax.InputSource getInputSourceFromURI(String uri, String username, String password)
          Utility to get the bytes at a protected uri This will retrieve the URL if a username and password are provided.
static org.w3c.dom.Document newDocument()
          Get an empty new Document
static org.w3c.dom.Document newDocument(org.xml.sax.InputSource inp)
           
static org.w3c.dom.Document newDocument(InputStream inp)
           
static org.w3c.dom.Document newDocument(String uri)
           
static org.w3c.dom.Document newDocument(String uri, String username, String password)
          Create a new document from the given URI, use the username and password if the URI requires authentication.
static String toString(org.w3c.dom.Document doc)
           
static String toString(org.w3c.dom.Element element)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.commons.logging.Log log

dbf

private static javax.xml.parsers.DocumentBuilderFactory dbf
Constructor Detail

XmlUtils

public XmlUtils()
Method Detail

getDOMFactory

private static javax.xml.parsers.DocumentBuilderFactory getDOMFactory()

newDocument

public static org.w3c.dom.Document newDocument()
                                        throws javax.xml.parsers.ParserConfigurationException
Get an empty new Document

Returns:
Document
Throws:
javax.xml.parsers.ParserConfigurationException - if construction problems occur

newDocument

public static org.w3c.dom.Document newDocument(org.xml.sax.InputSource inp)
                                        throws javax.xml.parsers.ParserConfigurationException,
                                               org.xml.sax.SAXException,
                                               IOException
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
IOException

newDocument

public static org.w3c.dom.Document newDocument(InputStream inp)
                                        throws javax.xml.parsers.ParserConfigurationException,
                                               org.xml.sax.SAXException,
                                               IOException
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
IOException

newDocument

public static org.w3c.dom.Document newDocument(String uri)
                                        throws javax.xml.parsers.ParserConfigurationException,
                                               org.xml.sax.SAXException,
                                               IOException
Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
IOException

newDocument

public static org.w3c.dom.Document newDocument(String uri,
                                               String username,
                                               String password)
                                        throws javax.xml.parsers.ParserConfigurationException,
                                               org.xml.sax.SAXException,
                                               IOException
Create a new document from the given URI, use the username and password if the URI requires authentication.

Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
IOException

getInputSourceFromURI

private static org.xml.sax.InputSource getInputSourceFromURI(String uri,
                                                             String username,
                                                             String password)
                                                      throws IOException
Utility to get the bytes at a protected uri This will retrieve the URL if a username and password are provided. The java.net.URL class does not do Basic Authentication, so we have to do it manually in this routine. If no username is provided, we create an InputSource from the uri and let the InputSource go fetch the contents.

Parameters:
uri - the resource to get
username - basic auth username
password - basic auth password
Throws:
IOException

toString

public static String toString(org.w3c.dom.Document doc)

toString

public static String toString(org.w3c.dom.Element element)

getFirstChildElement

public static org.w3c.dom.Element getFirstChildElement(org.w3c.dom.Element element)
Utility function for getting the first child element from a element

Parameters:
element - The parent element
Returns:
The first child element if one was found, null otherwise