|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.common.xml.XMLSchemaUtilities
Contains utility methods for working with XML schema documents.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
|
private static DAILogger |
LOG
|
Constructor Summary | |
XMLSchemaUtilities()
|
Method Summary | |
static void |
makeSchemaLocationsAbsolute(org.w3c.dom.Document doc,
java.lang.String base)
Converts the schemaLocation attributes of any
include elements contained within the specified
document to use absolute instead of relative paths. |
static void |
makeSchemaLocationsAbsolute(org.w3c.dom.Document doc,
java.net.URL base)
Converts the schemaLocation attributes of any
include elements contained within the specified
document to use absolute instead of relative paths. |
static void |
merge(org.w3c.dom.Document dest,
org.w3c.dom.Document src)
Merges two XML documents by importing the namespace attributes and child nodes of the root elements of each document. |
static void |
removeAllIncludes(org.w3c.dom.Document doc)
Removes all the include elements from an XML
document. |
static void |
removeIncludes(org.w3c.dom.Document doc,
java.lang.String schemaLocation)
Removes all the include elements with the
specified schemaLocation attribute from the
specified document. |
static void |
removeIncludes(org.w3c.dom.Document doc,
java.net.URL schemaLocation)
Removes all the include elements with the
specified schemaLocation attribute from the
specified document. |
static void |
validate(org.w3c.dom.Document document,
org.w3c.dom.Document schema)
Validates an XML document against a specified XML Schema. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private static final DAILogger LOG
Constructor Detail |
public XMLSchemaUtilities()
Method Detail |
public static void merge(org.w3c.dom.Document dest, org.w3c.dom.Document src)
dest
- The document to import the nodes into.src
- The document to import the nodes from.public static void makeSchemaLocationsAbsolute(org.w3c.dom.Document doc, java.net.URL base) throws DAIMalformedURLException
schemaLocation
attributes of any
include
elements contained within the specified
document to use absolute instead of relative paths.
doc
- XML code>Document.base
- Base URL
that paths are specified relative to.
DAIMalformedURLException
- if the URL formed from
base
plus any schemaLocation
is
malformed.public static void makeSchemaLocationsAbsolute(org.w3c.dom.Document doc, java.lang.String base) throws DAIMalformedURLException
schemaLocation
attributes of any
include
elements contained within the specified
document to use absolute instead of relative paths.
doc
- XML code>Document.base
- Base URL
that paths are specified relative to.
DAIMalformedURLException
- if the URL formed from
base
plus any schemaLocation
is
malformed or if base
itself is malformed.makeSchemaLocationsAbsolute(org.w3c.dom.Document, java.net.URL)
public static void removeAllIncludes(org.w3c.dom.Document doc)
include
elements from an XML
document.
doc
- The XML document to remove the elements from.public static void removeIncludes(org.w3c.dom.Document doc, java.net.URL schemaLocation)
include
elements with the
specified schemaLocation
attribute from the
specified document.
The schemaLocation
attributes are expected to
be absolute and not relative.
doc
- The XML document to remove the elements from.schemaLocation
- The value of the schemaLocation
attribute.makeSchemaLocationsAbsolute(org.w3c.dom.Document, java.net.URL)
public static void removeIncludes(org.w3c.dom.Document doc, java.lang.String schemaLocation) throws DAIMalformedURLException
include
elements with the
specified schemaLocation
attribute from the
specified document.
The schemaLocation
attributes are expected to
be absolute and not relative.
doc
- The XML document to remove the elements from.schemaLocation
- The value of the schemaLocation
attribute.
DAIMalformedURLException
- if schemaLocation
is
malformed.makeSchemaLocationsAbsolute(org.w3c.dom.Document, java.net.URL)
public static void validate(org.w3c.dom.Document document, org.w3c.dom.Document schema) throws XMLDocumentException, XMLParseException
This is achieved using a custom
SchemaEntityResolver
that bypasses the normal
mechanism where an XML Schema document would be loaded from a
specified URL.
document
- The XML document to validate.schema
- The XML Schema.
XMLDocumentException
- if the document does not validate
against the XML Schema.
XMLParseException
- if there is a problem with
the parser setup or execution.
ExternalModuleException
- if there is an internal problem
within Xerces when creating the Document
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |