public class XMLUtils extends Object
| Constructor and Description |
|---|
XMLUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Document |
loadXmlFromFile(File xmlFile)
Will load the XML from a file.
|
static Document |
loadXmlFromFile(File xmlFile,
URL schemaUrl)
Will load and validate angainst a schema the XML from a file.
|
static Document |
loadXmlFromInputStream(InputStream inputStream)
Loads the Document (DOM) from an InputStream.
|
static void |
validateXmlFile(File xmlFile,
File schemaFile)
Validates a XML file against schema located at schemaFile.
Inspirational code: http://stackoverflow.com/questions/15732/whats-the-best-way-to-validate-an-xml-file-against-an-xsd-file http://www.edankert.com/validate.html#Validate_using_external_Schema_s_ Note: Storing the schemas locally will greatly speed up the validating processing time. |
static void |
validateXmlFile(File xmlFile,
URL schemaUrl)
Validates a XML file against schema located at schemaUrl.
Inspirational code: http://stackoverflow.com/questions/15732/whats-the-best-way-to-validate-an-xml-file-against-an-xsd-file http://www.edankert.com/validate.html#Validate_using_external_Schema_s_ Note: Storing the schemas locally will greatly speed up the validating processing time. |
public static void validateXmlFile(File xmlFile, URL schemaUrl) throws PropertyIOException
xmlFile - the xml file that shall be validated.schemaUrl - the URL for the schema to validate the file.PropertyIOException - if xmlFile or schemaURL or invalid, or xml file did not validate against the schmapublic static void validateXmlFile(File xmlFile, File schemaFile) throws PropertyIOException
xmlFile - the xml file that shall be validated.schemaFile - the file containing the schema to validate the file.PropertyIOException - if xmlFile or schemaFile or invalid, or xml file did not validate against the schmapublic static Document loadXmlFromFile(File xmlFile) throws PropertyIOException
xmlFile - the xml filePropertyIOException - if the XML file is not well formed, or an IOException is thrown.public static Document loadXmlFromFile(File xmlFile, URL schemaUrl) throws PropertyIOException
xmlFile - the xml fileschemaUrl - the url for schema to validate against, if null then ignored.PropertyIOException - if the XML file is not wellformed did validate against the schema, or an IOException is thrown.public static Document loadXmlFromInputStream(InputStream inputStream) throws PropertyIOException
inputStream - the inputstream provided.PropertyIOException - if any error loading the Document.Document