public abstract class DOMUtilsImplBase extends java.lang.Object implements DOMUtilsInterface
DOMUtilsImplBase is the abstract base class for Toolkit classes that support the DOMUtilsInterface
through the JAXP API. The DOMUtilsImplBase superclass implements the methods from DOMUtilsInterface that
are not specific to any particular JAXP library. Other methods in the DOMUtilsInterface might need to
set particular parser attributes or invoke parser methods specific to a particular JAXP implementation or outside of JAXP.
For example, Apache parsers require that ID attributes be "registered". Those methods are declared abstract in this
DOMUtilsImplBase superclass, and they must be implemented by a parser-specific subclass.
DOMUtilsImplBase also provides an inner class that is an ErrorHandler.
iaik.ixsil.util.DOMUtils.
Internally, the Toolkit finds an implementation based on the Java property
DOMUtils.ImplementingClass in the init.properties file.
| Modifier and Type | Class and Description |
|---|---|
protected class |
DOMUtilsImplBase.NodeListImpl
Simple implementation for the DOM
NodeList interface. |
| Constructor and Description |
|---|
DOMUtilsImplBase() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
checkExpandedElementName(org.w3c.dom.Element element,
java.lang.String namespaceURI,
java.lang.String localName)
Checks if the expanded name of the specified element corresponds with the specified namespace URI and
local name.
|
abstract org.w3c.dom.Document |
createDocumentFromScratch()
Creates a new, empty DOM document.
|
abstract org.w3c.dom.Document |
createDocumentFromXMLInstance(java.io.InputStream xmlDocStream,
URI xmlDocBaseURI,
int validate,
java.lang.String noNamespaceSchemaLocation,
java.lang.String schemaLocations)
The DOM parser is configured not to report any Warnings, Errors or FatalErrors.
|
org.w3c.dom.Element |
getChildElementByTagNameNS(org.w3c.dom.Element parent,
java.lang.String namespaceURI,
java.lang.String localName,
int instance)
Returns the child element of the specified parent element, which matches the specified namespace URI
and the specified local name.
|
abstract org.w3c.dom.traversal.DocumentTraversal |
getDocumentTraversal(org.w3c.dom.Document doc)
Gets a DOM level 2
DocumentTraversal interface, which allows the creation
of DOM level 2 NodeIterator and TreeWalker
interfaces, for the specified DOM document. |
protected java.lang.String |
getNamespaceOfElement(org.w3c.dom.Element element)
Gets the namespace URI which is in scope for the specified element.
|
org.w3c.dom.NodeList |
listToNodeList(java.util.List list)
Converts a
List object into a NodeList object. |
abstract void |
registerID(org.w3c.dom.Document owningDoc,
org.w3c.dom.Element candidate,
java.lang.String idValue)
Registers a candidate DOM element with the value of its ID attribute at its owning DOM document.
|
abstract void |
replaceSignatureElement(org.w3c.dom.Element oldSigElem,
org.w3c.dom.Element newSigElem)
Replaces an old signature element, which is part of document A, with a new signature element, which
is part of document B.
|
abstract org.w3c.dom.Element |
schemaValidateSignatureElement(org.w3c.dom.Element signatureDOMElem,
java.lang.String additionalNoNamespaceSchemaLocation,
java.lang.String additionalSchemaLocations)
Validates a specified DOM element representing a XML signature against the signature schema specified
in the IXSIL init properties.
|
void |
serializeDocument(org.w3c.dom.Document doc,
java.io.OutputStream os)
Serializes the specified DOM document to the specified output stream.
|
void |
serializeDocument(org.w3c.dom.Document doc,
java.io.OutputStream os,
java.lang.String encoding)
Serializes the specified DOM Document to the specified output stream.
|
void |
serializeElement(org.w3c.dom.Element elem,
java.io.OutputStream elementSurface)
Serializes the specified DOM element to the specified output stream.
|
void |
setAttribute(org.w3c.dom.Element element,
java.lang.String namespaceURI,
java.lang.String namespacePrefix,
java.lang.String localName,
java.lang.String value)
Creates a DOM attribute from the specified parameters and adds it to the specified DOM element.
|
abstract void |
unregisterID(org.w3c.dom.Document owningDoc,
java.lang.String idValue)
Unregisters a candidate DOM element, which has been registerred with method
DOMUtilsInterface.registerID(org.w3c.dom.Document, org.w3c.dom.Element, java.lang.String) before,
at its owning DOM document. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCharacterDatapublic abstract void registerID(org.w3c.dom.Document owningDoc,
org.w3c.dom.Element candidate,
java.lang.String idValue)
throws DOMUtilsException
DOMUtilsInterfaceDocument.getElementById(java.lang.String). If a DOM element is already registerred under the
specified ID value, this method will have no effect.registerID in interface DOMUtilsInterfaceowningDoc - The DOM document which owns the candidate DOM element. Must not be null.candidate - The candidate DOM element to be registerred. Must not be null.idValue - The value of the candidate's ID attribute. Must not be null.DOMUtilsException - if registration fails for any reason.DOMUtilsInterface.registerID(org.w3c.dom.Document, org.w3c.dom.Element, java.lang.String)public abstract void unregisterID(org.w3c.dom.Document owningDoc,
java.lang.String idValue)
throws DOMUtilsException
DOMUtilsInterfaceDOMUtilsInterface.registerID(org.w3c.dom.Document, org.w3c.dom.Element, java.lang.String) before,
at its owning DOM document. If no DOM element is registerred under the specified ID value at the DOM
document, this method will have no effect.unregisterID in interface DOMUtilsInterfaceowningDoc - The DOM document which owns the candidate DOM element. Must not be null.idValue - The value of the candidate's ID attribute. Must not be null.DOMUtilsException - if undoing the registration fails for any reason.DOMUtilsInterface.unregisterID(org.w3c.dom.Document, java.lang.String)public abstract org.w3c.dom.Element schemaValidateSignatureElement(org.w3c.dom.Element signatureDOMElem,
java.lang.String additionalNoNamespaceSchemaLocation,
java.lang.String additionalSchemaLocations)
throws DOMUtilsException
DOMUtilsInterfaceschemaValidateSignatureElement in interface DOMUtilsInterfacesignatureDOMElem - The signature DOM element to be schema validated. Must not be null
.additionalNoNamespaceSchemaLocation - Provides an additional schema apart from the XMLDSIG schema
for elements in the no-namespace. Such a schema can be pro-
vided for the content of Object or
SignatureProperty elements. The parameter contains
the location URI for such a schema. May be null
.additionalSchemaLocations - Provides additional schemas apart from the XMLDSIG schema to be used
for validation. Such schemas can be provided for the content of
Object or SignatureProperty elements. Must either
be null or conform to the following rules:
additionalSchemas ::= additionalSchema (space additionalSchema)*
additionalSchema ::= schemaNamespaceURI space schemaLocationURI
For example,
"http://foo.org/mySchema http://repository.foo.org/mySchema.xsd".DOMUtilsException - if the validation fails for some reason.DOMUtilsInterface.schemaValidateSignatureElement(org.w3c.dom.Element, java.lang.String, java.lang.String)public abstract void replaceSignatureElement(org.w3c.dom.Element oldSigElem,
org.w3c.dom.Element newSigElem)
throws DOMUtilsException
DOMUtilsInterfacereplaceSignatureElement in interface DOMUtilsInterfaceoldSigElem - The old Signature DOM element which should be replaced. Must not be null
.newSigElem - The new Signature DOM element which should replace the old one. Must not be
null.DOMUtilsException - if the transfer fails for some reason.DOMUtilsInterface.replaceSignatureElement(org.w3c.dom.Element, org.w3c.dom.Element)public abstract org.w3c.dom.Document createDocumentFromScratch()
DOMUtilsInterfacecreateDocumentFromScratch in interface DOMUtilsInterfaceDOMUtilsInterface.createDocumentFromScratch()public abstract org.w3c.dom.traversal.DocumentTraversal getDocumentTraversal(org.w3c.dom.Document doc)
DOMUtilsInterfaceDocumentTraversal interface, which allows the creation
of DOM level 2 NodeIterator and TreeWalker
interfaces, for the specified DOM document.getDocumentTraversal in interface DOMUtilsInterfacedoc - The DOM document, for which a DocumentTraversal should be
returned.DocumentTraversal interface for the specified DOM document.DOMUtilsInterface.getDocumentTraversal(org.w3c.dom.Document)public abstract org.w3c.dom.Document createDocumentFromXMLInstance(java.io.InputStream xmlDocStream,
URI xmlDocBaseURI,
int validate,
java.lang.String noNamespaceSchemaLocation,
java.lang.String schemaLocations)
throws DOMUtilsException
DOMUtilsErrorHandler is registered at the parser. This error handler treats Warnings,
Errors and FatalErrors as specified by corresponding IXSIL properties.createDocumentFromXMLInstance in interface DOMUtilsInterfacexmlDocStream - The stream representation of the XML document.xmlDocBaseURI - Holds the base URI for the XML document used to resolve relative URIs.validate - Determines wheter the document should be validated or not. Please see the constants
DOMUtils.VALIDATION_YES_, DOMUtils.VALIDATION_NO_, DOMUtils.VALIDATION_DYNAMIC_ for further information.noNamespaceSchemaLocation - This URI string can be used to provide a Schema for the no-namespace
in cases where the DOM document should be created by a validating
parser (see also parameter validate). May be null
. Valid example: "http://repository.foo.org/mySchema.xsd".schemaLocations - This parameter can be used to provide schemas for various namespaces in cases
where the DOM document should be created by a validating parser (see also
parameter validate). Must either be null or conform
to the following rules:
additionalSchemas ::= additionalSchema (space additionalSchema)*
additionalSchema ::= schemaNamespaceURI space schemaLocationURI
For example, "http://foo.org/mySchema http://repository.foo.org/mySchema.xsd".DOMUtilsException - if creating the DOM document failed for any reason.DOMUtilsInterface.createDocumentFromXMLInstance(java.io.InputStream, iaik.ixsil.util.URI, int, java.lang.String, java.lang.String)public void serializeDocument(org.w3c.dom.Document doc,
java.io.OutputStream os)
throws DOMUtilsException
UTF-8.
serializeDocument in interface DOMUtilsInterfacedoc - The DOM Document to be serialized. Must not be null.os - The output stream where the serialization result is printed. Must not be
null.DOMUtilsExceptionpublic void serializeDocument(org.w3c.dom.Document doc,
java.io.OutputStream os,
java.lang.String encoding)
throws DOMUtilsException
serializeDocument in interface DOMUtilsInterfacedoc - The DOM document to be serialized. Must not be null.os - An output stream where the serialization result is printed.
Must not be null.encoding - The character encoding string that will be set in the XML declaration.
Must not be null.DOMUtilsExceptionpublic void serializeElement(org.w3c.dom.Element elem,
java.io.OutputStream elementSurface)
throws DOMUtilsException
serializeElement in interface DOMUtilsInterfaceelem - The DOM element to be serialized. Must not be null.elementSurface - The output stream where the serialization result is printed to. Must not be
null.DOMUtilsExceptionpublic org.w3c.dom.Element getChildElementByTagNameNS(org.w3c.dom.Element parent,
java.lang.String namespaceURI,
java.lang.String localName,
int instance)
DOMUtilsInterfacegetChildElementByTagNameNS in interface DOMUtilsInterfaceparent - The parent element bearing the requested child element. Must not be null.namespaceURI - The namespace URI of the requested child element. May be null to
indicate that the attribute should be in no namespace.localName - The local name of the requested child element. Must not be null.instance - A value of i will return the (i)th occurence of the requested element in the parent
element. Must be greater than or equal to 1.null if there is no such child element.DOMUtilsInterface.getChildElementByTagNameNS(Element, String, String, int)public boolean checkExpandedElementName(org.w3c.dom.Element element,
java.lang.String namespaceURI,
java.lang.String localName)
DOMUtilsInterfacecheckExpandedElementName in interface DOMUtilsInterfaceelement - The candidate element. Must not be null.namespaceURI - The namespace URI part of the expanded name. May be null if the
candidate element should be in no namespace.localName - The local name part of the expanded name. Must not be null.true, if the expanded name of the specified element corresponds with the
specified namespace URI and local name; false otherwise.DOMUtilsInterface.checkExpandedElementName(Element, String, String)public void setAttribute(org.w3c.dom.Element element,
java.lang.String namespaceURI,
java.lang.String namespacePrefix,
java.lang.String localName,
java.lang.String value)
DOMUtilsInterfacevalue parameter
equals null, the possibly existing DOM attribute will be removed from the DOM element.setAttribute in interface DOMUtilsInterfaceelement - The DOM element, which will become the owner of the new DOM attribute. Must not be
null.namespaceURI - The namespace URI for the attribute. May be null to indicate that the
attribute should be in no namespace.namespacePrefix - The namespace prefix for the attribute (including the final colon). Must not be
null. Use an empty string to indicate that no namespace prefix
should be used.localName - The local name for the attribute. Must not be null.value - The value for the attribute. May be null to indicate that the specified
DOM attribute should be removed from the specified DOM element.DOMUtilsInterface.setAttribute(Element, String, String, String, String)public org.w3c.dom.NodeList listToNodeList(java.util.List list)
DOMUtilsInterfaceList object into a NodeList object.listToNodeList in interface DOMUtilsInterfacelist - A List object constisting purely of Node objects.NodeList containing the specified nodes as member, or an empty NodeList if the specified List equals null.DOMUtilsInterface.listToNodeList(java.util.List)protected java.lang.String getNamespaceOfElement(org.w3c.dom.Element element)
element - The element for which the namespace URI should be detected. Must not be null
.null, if no namespace attribute has been found, or if a
namespace attribute has been found, but its value is an empty string.