OSFI-Java  3.9.2
OpenSF Integration Library
esa.opensf.osfi.XMLParser Class Reference

Classes

class  ParseException
 

Static Public Member Functions

static Document read (String xmlFile, String xsdFile) throws java.io.FileNotFoundException, XmlParseException
 
static Document read (final String xmlFile) throws java.io.FileNotFoundException, XmlParseException
 
static boolean validateAgainst (final Node docOrEl, final String xsdFile)
 
static boolean validateAgainstInternalSchema (final Node docOrEl)
 
static List< Element > getChildElements (Node node, String name)
 

Detailed Description

XMLParser.
XML file builder and parser. Uses the W3C DOM.

Author
ridr
Deprecated:
This class has been moved to XmlFiles and DomUtils to reduce clutter

Member Function Documentation

◆ getChildElements()

static List<Element> esa.opensf.osfi.XMLParser.getChildElements ( Node  node,
String  name 
)
static

Given a DOM Node, returns all the direct children elements with the given name.

Parameters
nodeNode whose direct children will be filtered
nameString that will be checked against the Node#getNodeName() value. If null, all direct child elements will be returned.

References esa.opensf.osfi.xmlutils.DomUtils.getChildElements().

◆ read() [1/2]

static Document esa.opensf.osfi.XMLParser.read ( final String  xmlFile) throws java.io.FileNotFoundException, XmlParseException
static

Read and parse a XML document, without validation.

Exceptions
java.io.FileNotFoundExceptionif the file cannot be loaded.
XmlParseExceptionif the XML cannot be parsed to a DOM document.

References esa.opensf.osfi.xmlutils.XmlFiles.load().

◆ read() [2/2]

static Document esa.opensf.osfi.XMLParser.read ( String  xmlFile,
String  xsdFile 
) throws java.io.FileNotFoundException, XmlParseException
static

Reads a XML file (optionally validating it against a XSD schema) and creates a DOM document. The parsed DOM Document is returned.

Parameters
xmlFileXML file location
xsdFileXSD file location. Null if not needed
Deprecated:
Due to the convoluted behaviour (to validate against internal schema a non-null but blank file has to be passed).

References esa.opensf.osfi.xmlutils.XmlFiles.load(), esa.opensf.osfi.xmlutils.XmlFiles.loadAndValidate(), and esa.opensf.osfi.xmlutils.XmlFiles.W3C_NS_URI_XSD10.

◆ validateAgainst()

static boolean esa.opensf.osfi.XMLParser.validateAgainst ( final Node  docOrEl,
final String  xsdFile 
)
static

Validate a document/element tree against an external XSD file.

Returns
true if the validation succeeds, false otherwise.
Exceptions
IllegalArgumentExceptionif the schema cannot be loaded

References esa.opensf.osfi.xmlutils.DomUtils.validateAgainst().

◆ validateAgainstInternalSchema()

static boolean esa.opensf.osfi.XMLParser.validateAgainstInternalSchema ( final Node  docOrEl)
static

Validate a document/element tree against a XSD schema referenced in the XML itself.

Returns
true if the validation succeeds, false otherwise.

References esa.opensf.osfi.xmlutils.DomUtils.validateAgainstInternalSchema().


The documentation for this class was generated from the following file: