|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jempbox.impl.XMLUtil
public class XMLUtil
This class with handle some simple XML operations.
Method Summary | |
---|---|
static byte[] |
asByteArray(org.w3c.dom.Document doc,
java.lang.String encoding)
Convert the document to an array of bytes. |
static org.w3c.dom.Element |
getElement(org.w3c.dom.Element parent,
java.lang.String elementName)
Get the first instance of an element by name. |
static java.lang.Integer |
getIntValue(org.w3c.dom.Element parent,
java.lang.String nodeName)
Get the integer value of a subnode. |
static java.lang.String |
getStringValue(org.w3c.dom.Element node)
This will get the text value of an element. |
static java.lang.String |
getStringValue(org.w3c.dom.Element parent,
java.lang.String nodeName)
Get the value of a subnode. |
static org.w3c.dom.Document |
newDocument()
Create a new blank XML document. |
static org.w3c.dom.Document |
parse(org.xml.sax.InputSource is)
This will parse an InputSource and create a DOM document. |
static org.w3c.dom.Document |
parse(java.io.InputStream is)
This will parse an XML stream and create a DOM document. |
static org.w3c.dom.Document |
parse(java.lang.String fileName)
This will parse an XML stream and create a DOM document. |
static void |
save(org.w3c.dom.Document doc,
java.lang.String file,
java.lang.String encoding)
Save the XML document to a file. |
static void |
save(org.w3c.dom.Node doc,
java.io.OutputStream outStream,
java.lang.String encoding)
Save the XML document to an output stream. |
static void |
setElementableValue(org.w3c.dom.Element parent,
java.lang.String name,
Elementable node)
Set an XML element document. |
static void |
setIntValue(org.w3c.dom.Element parent,
java.lang.String nodeName,
java.lang.Integer intValue)
Set the integer value of an element. |
static void |
setStringValue(org.w3c.dom.Element node,
java.lang.String value)
This will set the text value of an element. |
static void |
setStringValue(org.w3c.dom.Element parent,
java.lang.String nodeName,
java.lang.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 org.w3c.dom.Document parse(java.io.InputStream is) throws java.io.IOException
is
- The stream to get the XML from.
java.io.IOException
- It there is an error creating the dom.public static org.w3c.dom.Document parse(org.xml.sax.InputSource is) throws java.io.IOException
is
- The stream to get the XML from.
java.io.IOException
- It there is an error creating the dom.public static org.w3c.dom.Document parse(java.lang.String fileName) throws java.io.IOException
fileName
- The file to get the XML from.
java.io.IOException
- It there is an error creating the dom.public static org.w3c.dom.Document newDocument() throws java.io.IOException
java.io.IOException
- If there is an error creating the XML document.public static org.w3c.dom.Element getElement(org.w3c.dom.Element parent, java.lang.String elementName)
parent
- The parent to get the element from.elementName
- The name of the element to look for.
public static java.lang.Integer getIntValue(org.w3c.dom.Element parent, java.lang.String nodeName)
parent
- The parent element that holds the values.nodeName
- The name of the node that holds the integer value.
public static void setIntValue(org.w3c.dom.Element parent, java.lang.String nodeName, java.lang.Integer intValue)
parent
- The parent element that will hold this subelement.nodeName
- The name of the subelement.intValue
- The value to set.public static java.lang.String getStringValue(org.w3c.dom.Element parent, java.lang.String nodeName)
parent
- The parent element that holds the values.nodeName
- The name of the node that holds the value.
public static void setStringValue(org.w3c.dom.Element parent, java.lang.String nodeName, java.lang.String nodeValue)
parent
- The parent element that will hold this subelement.nodeName
- The name of the subelement.nodeValue
- The value to set.public static java.lang.String getStringValue(org.w3c.dom.Element node)
node
- The node to get the text value for.
public static void setStringValue(org.w3c.dom.Element node, java.lang.String value)
node
- The node to get the text value for.value
- The new value to set the node to.public static void setElementableValue(org.w3c.dom.Element parent, java.lang.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(org.w3c.dom.Document doc, java.lang.String file, java.lang.String encoding) throws javax.xml.transform.TransformerException
doc
- The XML document to save.file
- The file to save the document to.encoding
- The encoding to save the file as.
javax.xml.transform.TransformerException
- If there is an error while saving the XML.public static void save(org.w3c.dom.Node doc, java.io.OutputStream outStream, java.lang.String encoding) throws javax.xml.transform.TransformerException
doc
- The XML document to save.outStream
- The stream to save the document to.encoding
- The encoding to save the file as.
javax.xml.transform.TransformerException
- If there is an error while saving the XML.public static byte[] asByteArray(org.w3c.dom.Document doc, java.lang.String encoding) throws javax.xml.transform.TransformerException
doc
- The XML document.encoding
- The encoding of the output data.
javax.xml.transform.TransformerException
- If there is an error transforming to text.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |