|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.netarkivet.common.utils.XmlUtils
public class XmlUtils
Utilities for handling XML-files.
Constructor Summary | |
---|---|
XmlUtils()
|
Method Summary | |
---|---|
static org.dom4j.Document |
documentFromString(java.lang.String xml)
Parses a given string to produce a Document
instance. |
static org.dom4j.Document |
getXmlDoc(java.io.File f)
Read and parse an XML-file, and return a Document object representing this object. |
static org.dom4j.Document |
getXmlDoc(java.io.InputStream resourceAsStream)
Read and parse an XML stream, and return a Document object representing this object. |
static void |
setNode(org.dom4j.Document doc,
java.lang.String xpath,
java.lang.String value)
Set a XmlNode defined by the given XPath to the given value. |
static void |
validateWithXSD(java.io.File xsdFile)
Validate that the settings xml files conforms to the XSD. |
static void |
writeXmlToFile(org.dom4j.Document doc,
java.io.File f)
Write document tree to file. |
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.dom4j.Document getXmlDoc(java.io.File f) throws IOFailure
f
- a given xml file
IOFailure
- if unable to read the xml file
or unable to parse the file as XMLpublic static org.dom4j.Document getXmlDoc(java.io.InputStream resourceAsStream)
resourceAsStream
- a given xml document
IOFailure
- if unable to read the xml document
or unable to parse the document as XMLpublic static void setNode(org.dom4j.Document doc, java.lang.String xpath, java.lang.String value)
doc
- the Document, which is being modifiedxpath
- the given XPathvalue
- the given value
IOFailure
- If the given XPath was not found in the documentpublic static void validateWithXSD(java.io.File xsdFile)
xsdFile
- Schema to check settings against.
ArgumentNotValid
- if unable to validate the settings files
IOFailure
- If unable to read the settings files and/or
the xsd file.public static void writeXmlToFile(org.dom4j.Document doc, java.io.File f) throws IOFailure
doc
- the document tree to save.f
- the file to write the document to.
IOFailure
- On trouble writing XML file to disk.public static org.dom4j.Document documentFromString(java.lang.String xml) throws org.dom4j.DocumentException
Document
instance.
xml
- Some XML text.
Document
parsed from the given xml.
org.dom4j.DocumentException
- If unable to parse the given text as XML.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |