|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.atunes.kernel.utils.XMLUtils
public class XMLUtils
Utility methods for XML.
Constructor Summary | |
---|---|
XMLUtils()
|
Method Summary | |
---|---|
static org.w3c.dom.Node |
evaluateXPathExpressionAndReturnNode(java.lang.String expression,
org.w3c.dom.Node node)
Evaluates a XPath expression from a XML node, returning a Node object. |
static org.w3c.dom.NodeList |
evaluateXPathExpressionAndReturnNodeList(java.lang.String expression,
org.w3c.dom.Node node)
Evaluates a XPath expression from a XML node, returning a NodeList. |
static java.lang.String |
getAttributeValue(org.w3c.dom.Element element,
java.lang.String attributeName)
Returns the value of an attribute of a given XML element. |
static org.w3c.dom.Element |
getChildElement(org.w3c.dom.Element element,
java.lang.String tagName)
Returns a child element with a given name from an XML element. |
static java.lang.String |
getChildElementContent(org.w3c.dom.Element element,
java.lang.String tagName)
Returns value of a child element from a given XML element. |
static org.w3c.dom.Document |
getXMLDocument(java.lang.String xml)
Returns a XML Document object from an XML String. |
static java.lang.Object |
readBeanFromFile(java.lang.String filename)
Reads an object from an XML file. |
static java.lang.Object |
readObjectFromFile(java.lang.String filename)
Reads an object from a file as xml. |
static java.lang.Object |
readObjectFromString(java.lang.String string)
Reads an object from a String as xml. |
static void |
writeBeanToFile(java.lang.Object bean,
java.lang.String filename)
Writes an object to an XML file. |
static void |
writeObjectToFile(java.lang.Object object,
java.lang.String filename)
Writes an object to a file as xml. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLUtils()
Method Detail |
---|
public static org.w3c.dom.Node evaluateXPathExpressionAndReturnNode(java.lang.String expression, org.w3c.dom.Node node)
expression
- A XPath expressionnode
- The Node for which this expression should be evaluated
null
if an ecxception occuredpublic static org.w3c.dom.NodeList evaluateXPathExpressionAndReturnNodeList(java.lang.String expression, org.w3c.dom.Node node)
expression
- A XPath expressionnode
- The NodeList for which this expression should be evaluated
null
if an ecxception occured NodeListpublic static java.lang.String getAttributeValue(org.w3c.dom.Element element, java.lang.String attributeName)
element
- A elementattributeName
- The name of the attribute
null
if no such
attribute existspublic static org.w3c.dom.Element getChildElement(org.w3c.dom.Element element, java.lang.String tagName)
element
- A ElementtagName
- The name of the child element
null
if no such child existspublic static java.lang.String getChildElementContent(org.w3c.dom.Element element, java.lang.String tagName)
element
- A ElemnttagName
- The name of the child elment
public static org.w3c.dom.Document getXMLDocument(java.lang.String xml)
xml
- The String that should be parsed to an XML document
null
if the String
couldn't be parsedpublic static java.lang.Object readBeanFromFile(java.lang.String filename) throws java.io.IOException
filename
- the filename
java.io.IOException
- Signals that an I/O exception has occurred.public static java.lang.Object readObjectFromFile(java.lang.String filename) throws java.io.IOException
filename
- filename
java.io.IOException
- Signals that an I/O exception has occurred.public static java.lang.Object readObjectFromString(java.lang.String string)
string
- the string
public static void writeBeanToFile(java.lang.Object bean, java.lang.String filename) throws java.io.IOException
bean
- the beanfilename
- the filename
java.io.IOException
- Signals that an I/O exception has occurred.public static void writeObjectToFile(java.lang.Object object, java.lang.String filename) throws java.io.IOException
object
- Object that should be writen to a xml filefilename
- filename
java.io.IOException
- Signals that an I/O exception has occurred.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |