com.infoscape.xml
Class XMLUtils
java.lang.Object
|
+--com.infoscape.xml.XMLUtils
- public class XMLUtils
- extends java.lang.Object
A collection of utility methods for reading, writing and manipulating XML documents. Uses JDom. All methods are static.
|
Method Summary |
static org.jdom.Document |
get(java.lang.String spec)
This method takes a specification string and tries to determine whether it is a filename, a URI, or a piece of xml. |
static java.lang.String |
getChildText(java.lang.String xml,
java.lang.String tag)
This method takes an xml string and returns the text value of the first element with tag , without actually parsing. |
static org.jdom.Document |
getFromFile(java.lang.String filename)
|
static org.jdom.Document |
getFromString(java.lang.String str)
|
static org.jdom.Document |
getFromURI(java.lang.String uri)
|
static void |
print(org.jdom.Document doc,
java.io.OutputStream out)
|
static void |
print(org.jdom.Element elt,
java.io.OutputStream out)
|
static java.util.Properties |
toProperties(org.jdom.Document doc)
|
static java.util.Properties |
toProperties(org.jdom.Element root)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XMLUtils
public XMLUtils()
getFromFile
public static org.jdom.Document getFromFile(java.lang.String filename)
throws java.lang.Exception
- Parameters:
filename -
- Throws:
java.lang.Exception
getFromString
public static org.jdom.Document getFromString(java.lang.String str)
throws java.lang.Exception
- Parameters:
str -
- Throws:
java.lang.Exception
getFromURI
public static org.jdom.Document getFromURI(java.lang.String uri)
throws java.lang.Exception
- Parameters:
uri -
- Throws:
java.lang.Exception
get
public static org.jdom.Document get(java.lang.String spec)
throws java.lang.Exception
- This method takes a specification string and tries to determine whether it is a filename, a URI, or a piece of xml. It then passes the spec to the appropriate getFrom.. method.
- Parameters:
spec -
- Throws:
java.lang.Exception
getChildText
public static java.lang.String getChildText(java.lang.String xml,
java.lang.String tag)
throws java.lang.Exception
- This method takes an xml string and returns the text value of the first element with tag , without actually parsing.
- Throws:
java.lang.Exception
print
public static void print(org.jdom.Document doc,
java.io.OutputStream out)
throws java.lang.Exception
- Parameters:
doc - out -
- Throws:
java.lang.Exception
print
public static void print(org.jdom.Element elt,
java.io.OutputStream out)
throws java.lang.Exception
- Parameters:
elt - out -
- Throws:
java.lang.Exception
toProperties
public static java.util.Properties toProperties(org.jdom.Document doc)
throws java.lang.Exception
- Parameters:
doc -
- Throws:
java.lang.Exception
toProperties
public static java.util.Properties toProperties(org.jdom.Element root)
throws java.lang.Exception
- Parameters:
root -
- Throws:
java.lang.Exception