|
static LoadResult< Document > | load (final File file) throws FileNotFoundException |
|
static LoadResult< Document > | load (final File file, final boolean stopOnFirstError) throws FileNotFoundException |
|
static LoadResult< Document > | loadAndValidate (final File file, final File schema, final String schemaLang, final boolean stopOnFirstError) throws FileNotFoundException |
|
static LoadResult< Void > | validate (final File xmlFile, final File schemaFile, final String schemaLanguage, final boolean stopOnFirstError) |
|
◆ load() [1/2]
static LoadResult<Document> esa.opensf.osfi.xmlutils.XmlFiles.load |
( |
final File |
file | ) |
throws FileNotFoundException |
|
static |
◆ load() [2/2]
static LoadResult<Document> esa.opensf.osfi.xmlutils.XmlFiles.load |
( |
final File |
file, |
|
|
final boolean |
stopOnFirstError |
|
) |
| throws FileNotFoundException |
|
static |
◆ loadAndValidate()
static LoadResult<Document> esa.opensf.osfi.xmlutils.XmlFiles.loadAndValidate |
( |
final File |
file, |
|
|
final File |
schema, |
|
|
final String |
schemaLang, |
|
|
final boolean |
stopOnFirstError |
|
) |
| throws FileNotFoundException |
|
static |
Read and parse a XML document, validating against an internal or external schema.
- Parameters
-
file | Path to the XML document |
schema | Path to the schema |
schemaLang | One of the constants in this class denoting a schema language. |
stopOnFirstError | If true, validation will stop once any error is found. Otherwise, only a fatal error will stop the process and all errors will be logged. |
- Exceptions
-
FileNotFoundException | if the file cannot be loaded. |
- Returns
- An object containing the result (if successful) and the list of parsing/validation warnings and errors.
- See also
- load(File, boolean) to parse without validation
-
validate(File, File, String, boolean) to validate a file without retrieving the data
-
DomUtils::validateAgainst(org.w3c.dom.Node, String) to validate after parsing
-
DomUtils::validateAgainstInternalSchema(org.w3c.dom.Node) to validate after parsing
◆ validate()
static LoadResult<Void> esa.opensf.osfi.xmlutils.XmlFiles.validate |
( |
final File |
xmlFile, |
|
|
final File |
schemaFile, |
|
|
final String |
schemaLanguage, |
|
|
final boolean |
stopOnFirstError |
|
) |
| |
|
static |
Validates an XML file against a schema. This function never throws.
- Parameters
-
xmlFile | XML file location, must not be null. |
schemaFile | Schema file location. If null, the result depends on the schema language. For XSD, a schema linked by the XML file ("internal schema") will be used. |
schemaLanguage | Constant for the schema language to use. |
stopOnFirstError | If true, processing will be interrupted on the first error issued. |
- Returns
- An instance of LoadResult with the parse+validation events. The result field itself is always .
- See also
- loadAndValidate(File, File, String, boolean) to also get the DOM document
-
DomUtils::validateAgainst(org.w3c.dom.Node, String) to validate a loaded DOM tree
-
DomUtils::validateAgainstInternalSchema(org.w3c.dom.Node) to validate a loaded DOM tree
References esa.opensf.osfi.LoadResult< R >.SEV_ERROR, esa.opensf.osfi.LoadResult< R >.SEV_FATAL, and esa.opensf.osfi.LoadResult< R >.SEV_WARNING.
◆ W3C_NS_URI_XSD10
final String esa.opensf.osfi.xmlutils.XmlFiles.W3C_NS_URI_XSD10 = XMLConstants.W3C_XML_SCHEMA_NS_URI |
|
static |
Default version of the XSD standard; Java 8 states that at least XSD 1.0 is supported.
◆ W3C_NS_URI_XSD11
final String esa.opensf.osfi.xmlutils.XmlFiles.W3C_NS_URI_XSD11 = "http://www.w3.org/XML/XMLSchema/v1.1" |
|
static |
XSD standard version 1.1 (specifically). It may not be supported if not using a specific library e.g. Xerces-J 2.11 or later.
The documentation for this class was generated from the following file:
- src/Java/esa/opensf/osfi/xmlutils/XmlFiles.java