public abstract class Transform extends Algorithm
setInput(InputStream, URI), the latter with the method setInput(NodeList, URI). The result of
a transform can either be an octet stream or a XPath node set.| Modifier and Type | Field and Description |
|---|---|
protected org.w3c.dom.NodeList |
inputNodeSet_
The XPath node set input data for the algorithm.
|
protected java.io.InputStream |
inputOctetStream_
The octet stream input data for the algorithm.
|
protected URI |
inputURI_
An identifier for the input data for the algorithm.
|
| Constructor and Description |
|---|
Transform() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List |
distributeNSDeclarations(org.w3c.dom.Element specElement,
boolean skipStylesheet)
This method is part of a workaround necessary to cope with differences in the tree model of XPath
and DOM with respect to namespace declarations (TreeModelWorkaround).
|
void |
setInput(java.io.InputStream input,
URI inputURI)
Sets the data to be processed by the transform as an octet stream.
|
void |
setInput(org.w3c.dom.NodeList input,
URI inputURI)
Sets the data to be processed by the transform as a XPath node set.
|
protected static org.w3c.dom.Element |
skipStylesheetElem(org.w3c.dom.Element candidate,
org.w3c.dom.Element specElement,
org.w3c.dom.traversal.NodeIterator allNodes)
This method is part of a workaround necessary to cope with differences in the tree model of XPath
and DOM with respect to namespace declarations (TreeModelWorkaround).
|
abstract java.lang.Object |
transform()
Computes the result of the transform, according to the implemented algorithm either as octet stream or
as XPath node set.
|
static void |
withdrawDistributedNSDeclarations(org.w3c.dom.Element element,
java.util.List addedNSDecls)
This method is part of a workaround necessary to cope with differences in the tree model of XPath
and DOM with respect to namespace declarations (TreeModelWorkaround).
|
getURI, setParameters, setURI, toElementprotected java.io.InputStream inputOctetStream_
protected org.w3c.dom.NodeList inputNodeSet_
protected URI inputURI_
public abstract java.lang.Object transform()
throws AlgorithmException
InputStream or
NodeList.AlgorithmException - if computing the transform's result fails for any reason.public void setInput(java.io.InputStream input,
URI inputURI)
input - The octet stream to be processed by the transform. Must not be null.inputURI - An identifier for the input resource. Can be used by an implementation to absolutize
relative URIs within the input resource. May be null.public void setInput(org.w3c.dom.NodeList input,
URI inputURI)
input - The XPath node set to be processed by the transform. Must not be null.inputURI - An identifier for the input resource. Can be used by an implementation to absolutize
relative URIs within the input resource. May be null.public static java.util.List distributeNSDeclarations(org.w3c.dom.Element specElement,
boolean skipStylesheet)
This method is part of a workaround necessary to cope with differences in the tree model of XPath and DOM with respect to namespace declarations (TreeModelWorkaround).
Takes the owner document of the specified DOM element and distributes all namespace declarations
(i. e. attributes named xmlns or with a name prefix xmlns:) to all elements
of the document. This means, that all namespace declarations which are in scope for a particular
element being part of the owner document, will be explicitly set after an invocation of this method.
If the parameter skipStylesheet is true, namespace declarations are not
distributed to an element elem if it fulfills all of the following conditions:
stylesheet or transform.http://www.w3.org/1999/XSL/Transform.specElement or one of its ancestors is an XML
Signature element (dsig:Signature) and elem is a descendant of that XML Signature element as
well.specElement - An element part of the document to be treated as explained above.skipStylesheet - See explanation above.protected static org.w3c.dom.Element skipStylesheetElem(org.w3c.dom.Element candidate,
org.w3c.dom.Element specElement,
org.w3c.dom.traversal.NodeIterator allNodes)
This method is part of a workaround necessary to cope with differences in the tree model of XPath and DOM with respect to namespace declarations (TreeModelWorkaround).
If all of the following conditions are met, iterate through allNodes and return next
element, which is not a descendant of candidate; return null, if there is
no such element any more. If one of the conditions is not met, return candidate.
candidate's local name is stylesheet or transform.candidate's namespace is http://www.w3.org/1999/XSL/Transform.specElement or one of its ancestors is an XML Signature element (dsig:Signature) and
candidate is a descendant of that XML Signature element as well.candidate - See explanation above.specElement - See explanation above.allNodes - See explanation above.public static void withdrawDistributedNSDeclarations(org.w3c.dom.Element element,
java.util.List addedNSDecls)
This method is part of a workaround necessary to cope with differences in the tree model of XPath and DOM with respect to namespace declarations (TreeModelWorkaround).
Removes all namespace declarations specified in parameterCaddedNSDecls from the owner
document of the specified DOM element. If the owner document of a namespace declaration is not the
specified owner document of the specified DOM element, or if the owner element of a namespace
declaration is not set, the declaration will be ignored.element - A DOM element part of the DOM document to remove the namespace declarations from. Must
not be null.addedNSDecls - A List containing objects of type org.w3c.dom.Attr representing the
namespace declarations to be removed. Must not be null.