public class DDMSReader
extends Object
This parsing performs schema validation against a local set of DDMS/ISM schemas.
Constructor and Description |
---|
DDMSReader(DDMSVersion version)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addExternalSchemaLocation(String xmlNamespace,
String schemaLocation)
Add additional schema locations to those already known by this DDMSReader.
|
protected Resource |
buildResource(nu.xom.Element xomElement)
Shared helper method to build a DDMS Resource from a XOM Element
|
Resource |
getDDMSResource(File file)
Creates a DDMS resource based on the contents of a file, and also sets the DDMSVersion based on the namespace
URIs in the file.
|
Resource |
getDDMSResource(InputStream inputStream)
Creates a DDMS resource based on the contents of an input stream, and also sets the DDMSVersion based on the
namespace URIs in the document.
|
Resource |
getDDMSResource(Reader reader)
Creates a DDMS resource based on the contents of a reader, and also sets the DDMSVersion based on the namespace
URIs in the document.
|
Resource |
getDDMSResource(String xml)
Creates a DDMS resource based on the contents of a string representation of an XML document, and also sets the
DDMSVersion based on the namespace URIs in the document.
|
nu.xom.Element |
getElement(File file)
Creates a XOM element representing the root XML element in the file.
|
nu.xom.Element |
getElement(InputStream inputStream)
Creates a XOM element representing the root XML element in an input stream.
|
nu.xom.Element |
getElement(Reader reader)
Creates a XOM element representing the root XML element in a reader.
|
nu.xom.Element |
getElement(String xml)
Creates a XOM element representing the root XML element in a string representation of an XML document.
|
String |
getExternalSchemaLocations()
Returns the external schema locations.
|
protected String |
getLocalSchemaLocation(String schemaLocation)
Returns the full path to a local schema copy, based on the relative location from the
properties file.
|
static void |
validateWithSchema(DDMSVersion version,
String resourceXML)
Attempts to build an Element from a Resource XML string.
|
public DDMSReader(DDMSVersion version) throws org.xml.sax.SAXException
Schemas are loaded in reverse order, so the latest, greatest copy is always first to be looked for.
Creates a DDMSReader which can process various versions of DDMS and GMLorg.xml.sax.SAXException
protected String getLocalSchemaLocation(String schemaLocation)
schemaLocation
- the relative schema location as specified in the properties fileIllegalArgumentException
- if the schema could not be found.public static void validateWithSchema(DDMSVersion version, String resourceXML) throws InvalidDDMSException
version
- the DDMSVersion of the resourceresourceXML
- the XML of the resource to checkInvalidDDMSException
- if the resource is invalidpublic nu.xom.Element getElement(File file) throws IOException, InvalidDDMSException
The implementation of this method delegates to the Reader-based overloaded method.
file
- the file containing the XML documentIOException
InvalidDDMSException
public nu.xom.Element getElement(String xml) throws IOException, InvalidDDMSException
The implementation of this method delegates to the Reader-based overloaded method.
xml
- a string containing the XML documentIOException
InvalidDDMSException
public nu.xom.Element getElement(InputStream inputStream) throws IOException, InvalidDDMSException
The implementation of this method delegates to the Reader-based overloaded method.
inputStream
- a stream mapping to an XML documentIOException
InvalidDDMSException
public nu.xom.Element getElement(Reader reader) throws IOException, InvalidDDMSException
reader
- a reader mapping to an XML documentIOException
InvalidDDMSException
public Resource getDDMSResource(File file) throws IOException, InvalidDDMSException
file
- the file containing the DDMS Resource.InvalidDDMSException
- if the component could not be builtIOException
public Resource getDDMSResource(String xml) throws IOException, InvalidDDMSException
xml
- the string representation of the XML DDMS ResourceInvalidDDMSException
- if the component could not be builtIOException
public Resource getDDMSResource(InputStream inputStream) throws IOException, InvalidDDMSException
inputStream
- the input stream wrapped around an XML DDMS ResourceInvalidDDMSException
- if the component could not be builtIOException
public Resource getDDMSResource(Reader reader) throws IOException, InvalidDDMSException
reader
- the reader wrapped around an XML DDMS ResourceInvalidDDMSException
- if the component could not be builtIOException
protected Resource buildResource(nu.xom.Element xomElement) throws InvalidDDMSException
xomElement
- InvalidDDMSException
- if the component could not be builtpublic String getExternalSchemaLocations()
public void addExternalSchemaLocation(String xmlNamespace, String schemaLocation)
xmlNamespace
- the unique XML namespace for the schema contentschemaLocation
- the accessible location of the XML Schema file to be used for validationIllegalArgumentException
- if the DDMSReader already knows about the specified xmlNamespaceCopyright 2010 - 2019 by Brian Uri!
Generated on 09/15/2016 12:36 PM
https://ddmsence.urizone.net/