public class DOMUtilsImplApache extends DOMUtilsImplBase implements DOMUtilsInterface
DOMUtilsImplBase lets the Toolkit use an Apache XML
parser that resides in your Java runtime, as an installed JRE extension or on the
class path. You should configure the Toolkit to use this class if your application
has created a DOM Document instance using an Apache parser, and you
want to provide that Document to the constructor of the Toolkit's
Signer or Verifier.
To ensure that the Toolkit will use the external JAXP implementation in the Apache
libraries, instead of its internal implementation, set the following property in
the Toolkit's XML initialization file (usually called init.properties);
DOMUtils.ImplementingClass as follows;
DOMUtils.createDocumentFromXMLInstance(java.io.InputStream, iaik.ixsil.util.URI, int, java.lang.String, java.lang.String).
The Toolkit's internal parser is based on Apache Xerces 1.4.4.
DOMUtils.
Internally, the Toolkit finds an implementation based on the Java property
DOMUtils.ImplementingClass in the init.properties file.
DOMUtilsImplApache sets the parser Properties and Features specific to
Apache, but it does this through the JAXP API, without using classes or methods specific to
Apache parsers. Furthermore, it does not import any classes from org.apache packages,
so it should work with most versions of the Apache libraries (even though the Apache parser classes
are located in different Java packages for different Apache releases; for example, the
DOMParser class derives from org.apache.xerces.framework.XMLParser
in Xerces 1.4.4, but from org.apache.xerces.parsers.XMLParser in Xerces 2).
The Toolkit has been tested with Xerces 1.4.4, Xerces 2.0.2, Xerces 2.4, Xalan 2.3.1,
and Xalan 2.4. It will not work properly with Xerces 2.3; if your application must use
that version, use the alternate procedure described above, setting
DOMUtils.ImplementingClass to the the Toolkit's internal parser.
DOMUtilsImplBase.NodeListImpl| Constructor and Description |
|---|
DOMUtilsImplApache() |
| Modifier and Type | Method and Description |
|---|---|
org.w3c.dom.Document |
createDocumentFromScratch()
Creates a new, empty DOM document.
|
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.
|
java.lang.String |
getCharacterData(org.w3c.dom.Element parent)
Returns a concatenation of all text children of the specified parent element.
|
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. |
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.
|
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.
|
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 |
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. |
checkExpandedElementName, getChildElementByTagNameNS, getNamespaceOfElement, listToNodeList, serializeDocument, serializeDocument, serializeElement, setAttributeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckExpandedElementName, getChildElementByTagNameNS, listToNodeList, serializeDocument, serializeDocument, serializeElement, setAttributepublic org.w3c.dom.Element schemaValidateSignatureElement(org.w3c.dom.Element signatureDOMElem,
java.lang.String additionalNoNamespaceSchemaLocation,
java.lang.String additionalSchemaLocations)
throws DOMUtilsException
DOMUtilsInterfaceschemaValidateSignatureElement in interface DOMUtilsInterfaceschemaValidateSignatureElement in class DOMUtilsImplBasesignatureDOMElem - 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 void replaceSignatureElement(org.w3c.dom.Element oldSigElem,
org.w3c.dom.Element newSigElem)
throws DOMUtilsException
DOMUtilsInterfacereplaceSignatureElement in interface DOMUtilsInterfacereplaceSignatureElement in class DOMUtilsImplBaseoldSigElem - 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 org.w3c.dom.Document createDocumentFromScratch()
DOMUtilsInterfacecreateDocumentFromScratch in interface DOMUtilsInterfacecreateDocumentFromScratch in class DOMUtilsImplBaseDOMUtilsInterface.createDocumentFromScratch()public 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 DOMUtilsInterfacegetDocumentTraversal in class DOMUtilsImplBasedoc - The DOM document, for which a DocumentTraversal should be
returned.DocumentTraversal interface for the specified DOM document.DOMUtilsInterface.getDocumentTraversal(org.w3c.dom.Document)public 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 DOMUtilsInterfacecreateDocumentFromXMLInstance in class DOMUtilsImplBasexmlDocStream - 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 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 DOMUtilsInterfaceregisterID in class DOMUtilsImplBaseowningDoc - 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 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 DOMUtilsInterfaceunregisterID in class DOMUtilsImplBaseowningDoc - 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 java.lang.String getCharacterData(org.w3c.dom.Element parent)
DOMUtilsInterfacegetCharacterData in interface DOMUtilsInterfaceparent - The parent element.null, if
the element does not contain any text children or if all text children represent text with zero
length.