org.globus.wsrf.utils
Class XmlUtils
java.lang.Object
org.globus.wsrf.utils.XmlUtils
- public class XmlUtils
- extends java.lang.Object
|
Field Summary |
private static javax.xml.parsers.DocumentBuilderFactory |
dbf
|
private static org.apache.commons.logging.Log |
log
|
|
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(java.lang.String uri,
java.lang.String username,
java.lang.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(java.io.InputStream inp)
|
static org.w3c.dom.Document |
newDocument(java.lang.String uri)
|
static org.w3c.dom.Document |
newDocument(java.lang.String uri,
java.lang.String username,
java.lang.String password)
Create a new document from the given URI, use the username and password
if the URI requires authentication. |
static java.lang.String |
toString(org.w3c.dom.Document doc)
|
static java.lang.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 |
log
private static org.apache.commons.logging.Log log
dbf
private static javax.xml.parsers.DocumentBuilderFactory dbf
XmlUtils
public XmlUtils()
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,
java.io.IOException
- Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
newDocument
public static org.w3c.dom.Document newDocument(java.io.InputStream inp)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException
- Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
newDocument
public static org.w3c.dom.Document newDocument(java.lang.String uri)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException
- Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
newDocument
public static org.w3c.dom.Document newDocument(java.lang.String uri,
java.lang.String username,
java.lang.String password)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.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
java.io.IOException
getInputSourceFromURI
private static org.xml.sax.InputSource getInputSourceFromURI(java.lang.String uri,
java.lang.String username,
java.lang.String password)
throws java.io.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 getusername - basic auth usernamepassword - basic auth password
- Throws:
java.io.IOException
toString
public static java.lang.String toString(org.w3c.dom.Document doc)
toString
public static java.lang.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