|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jempbox.impl.XMLUtil
This class with handle some simple XML operations.
| Method Summary | |
static Element |
getElement(Element parent,
String elementName)
Get the first instance of an element by name. |
static Integer |
getIntValue(Element parent,
String nodeName)
Get the integer value of a subnode. |
static String |
getStringValue(Element node)
This will get the text value of an element. |
static String |
getStringValue(Element parent,
String nodeName)
Get the value of a subnode. |
static Document |
newDocument()
Create a new blank XML document. |
static Document |
parse(InputStream is)
This will parse an XML stream and create a DOM document. |
static Document |
parse(String fileName)
This will parse an XML stream and create a DOM document. |
static void |
save(Document doc,
String file,
String encoding)
Save the XML document to a file. |
static void |
setElementableValue(Element parent,
String name,
Elementable node)
Set an XML element document. |
static void |
setIntValue(Element parent,
String nodeName,
Integer intValue)
Set the integer value of an element. |
static void |
setStringValue(Element node,
String value)
This will set the text value of an element. |
static void |
setStringValue(Element parent,
String nodeName,
String nodeValue)
Set the value of an element. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static Document parse(InputStream is)
throws IOException
is - The stream to get the XML from.
IOException - It there is an error creating the dom.
public static Document parse(String fileName)
throws IOException
fileName - The file to get the XML from.
IOException - It there is an error creating the dom.
public static Document newDocument()
throws IOException
IOException - If there is an error creating the XML document.
public static Element getElement(Element parent,
String elementName)
parent - The parent to get the element from.elementName - The name of the element to look for.
public static Integer getIntValue(Element parent,
String nodeName)
parent - The parent element that holds the values.nodeName - The name of the node that holds the integer value.
NumberFormatException - If there is an error creating the Integer.
public static void setIntValue(Element parent,
String nodeName,
Integer intValue)
parent - The parent element that will hold this subelement.nodeName - The name of the subelement.intValue - The value to set.
public static String getStringValue(Element parent,
String nodeName)
parent - The parent element that holds the values.nodeName - The name of the node that holds the value.
public static void setStringValue(Element parent,
String nodeName,
String nodeValue)
parent - The parent element that will hold this subelement.nodeName - The name of the subelement.nodeValue - The value to set.public static String getStringValue(Element node)
node - The node to get the text value for.
public static void setStringValue(Element node,
String value)
node - The node to get the text value for.value - The new value to set the node to.
public static void setElementableValue(Element parent,
String name,
Elementable node)
parent - The parent document to set the value in.name - The name of the XML element to set.node - The node to set or clear.
public static void save(Document doc,
String file,
String encoding)
throws TransformerException
doc - The XML document to save.file - The file to save the document to.encoding - The encoding to save the file as.
TransformerException - If there is an error while saving the XML.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||