Class XmlFunctions
- java.lang.Object
-
- de.ipk_gatersleben.bit.bi.edal.primary_data.reference.datacite.XmlFunctions
-
public class XmlFunctions extends java.lang.Object
Usefull function to handle XML files.
-
-
Constructor Summary
Constructors Constructor Description XmlFunctions()
-
Method Summary
Modifier and Type Method Description static org.w3c.dom.Document
parse(java.io.File xmlFile)
parse.static org.w3c.dom.Document
parse(java.lang.String xmlString)
Parse a string containing XML.static java.lang.String
toString(org.w3c.dom.Document document)
Convert XML DOM document to a string.static void
validate(java.net.URL schemaFile, org.w3c.dom.Document xmlDocument)
Validate a XML-Document
against a XSD-SchemaFile.
-
-
-
Method Detail
-
parse
public static org.w3c.dom.Document parse(java.lang.String xmlString)
Parse a string containing XML.- Parameters:
xmlString
- the XML string- Returns:
- XML DOM document
-
parse
public static org.w3c.dom.Document parse(java.io.File xmlFile)
parse.
- Parameters:
xmlFile
- aFile
object.- Returns:
- a
Document
object.
-
toString
public static java.lang.String toString(org.w3c.dom.Document document)
Convert XML DOM document to a string.- Parameters:
document
- XML DOM document- Returns:
- XML string
-
validate
public static void validate(java.net.URL schemaFile, org.w3c.dom.Document xmlDocument) throws org.xml.sax.SAXException, java.io.IOException
Validate a XML-Document
against a XSD-SchemaFile.- Parameters:
schemaFile
- the XSD-URL
.xmlDocument
- the XML-Document
.- Throws:
org.xml.sax.SAXException
- if there is an validation error.java.io.IOException
- if unable to access the files.
-
-