electric.xml.canonical
Class Canonicalizer

java.lang.Object
  extended byelectric.xml.canonical.Canonicalizer
All Implemented Interfaces:
ICanonicalizer
Direct Known Subclasses:
ExclusiveCanonicalizer

public abstract class Canonicalizer
extends java.lang.Object
implements ICanonicalizer

Canonicalizer XML Documents can differ in syntax but still be logically equivelent. A Canonicalizer takes XPath data model nodes and turns the nodes into a sequence of bytes, which may then be compared to the bytes generated by the canonicalzation of a different set of nodes. If the canonical bytes match, then the nodes are assumed to be logically equivalent. The XPath data model differs subtly from the normal DOM object model, mainly in how XML Namespaces are handled. See the XPath spec for details.

Author:
webMethods

Field Summary
static java.lang.String ALL_NODES_PATH
           
 
Constructor Summary
Canonicalizer()
           
 
Method Summary
 byte[] canonicalize(NodeSet nodeSet, Node root)
           
abstract  void canonicalize(NodeSet nodeSet, Node root, java.io.OutputStream output)
           
protected  void write(Node root, NodeSet nodeSet, java.util.Stack state)
           
protected abstract  void writeAttribute(Attribute root, NodeSet nodeSet, java.util.Stack state, boolean writeNode)
           
protected abstract  void writeDocument(Document document, NodeSet nodeSet, java.util.Stack state, boolean writeNode)
           
protected abstract  void writeElement(Element element, NodeSet nodeSet, java.util.Stack state, boolean writeNode)
           
protected abstract  void writeNamespace(XPathNamespace root, NodeSet nodeSet, java.util.Stack state, boolean writeNode)
           
protected abstract  void writeText(Text root, NodeSet nodeSet, java.util.Stack state, boolean writeNode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL_NODES_PATH

public static final java.lang.String ALL_NODES_PATH
See Also:
Constant Field Values
Constructor Detail

Canonicalizer

public Canonicalizer()
Method Detail

writeDocument

protected abstract void writeDocument(Document document,
                                      NodeSet nodeSet,
                                      java.util.Stack state,
                                      boolean writeNode)
                               throws java.lang.Exception
Parameters:
document -
nodeSet -
state -
writeNode -
Throws:
java.lang.Exception

writeElement

protected abstract void writeElement(Element element,
                                     NodeSet nodeSet,
                                     java.util.Stack state,
                                     boolean writeNode)
                              throws java.lang.Exception
Parameters:
element -
nodeSet -
state -
writeNode -
Throws:
java.lang.Exception

writeAttribute

protected abstract void writeAttribute(Attribute root,
                                       NodeSet nodeSet,
                                       java.util.Stack state,
                                       boolean writeNode)
                                throws java.lang.Exception
Parameters:
root -
nodeSet -
state -
writeNode -
Throws:
java.lang.Exception

writeNamespace

protected abstract void writeNamespace(XPathNamespace root,
                                       NodeSet nodeSet,
                                       java.util.Stack state,
                                       boolean writeNode)
                                throws java.lang.Exception
Parameters:
root -
nodeSet -
state -
writeNode -
Throws:
java.lang.Exception

writeText

protected abstract void writeText(Text root,
                                  NodeSet nodeSet,
                                  java.util.Stack state,
                                  boolean writeNode)
                           throws java.lang.Exception
Parameters:
root -
nodeSet -
state -
writeNode -
Throws:
java.lang.Exception

write

protected void write(Node root,
                     NodeSet nodeSet,
                     java.util.Stack state)
              throws java.lang.Exception
Parameters:
root -
nodeSet -
state -
Throws:
java.lang.Exception

canonicalize

public byte[] canonicalize(NodeSet nodeSet,
                           Node root)
                    throws CanonicalizationException
Specified by:
canonicalize in interface ICanonicalizer
Parameters:
nodeSet -
root -
Throws:
CanonicalizationException

canonicalize

public abstract void canonicalize(NodeSet nodeSet,
                                  Node root,
                                  java.io.OutputStream output)
                           throws CanonicalizationException
Specified by:
canonicalize in interface ICanonicalizer
Parameters:
nodeSet -
root -
output -
Throws:
CanonicalizationException


copyright© 2001-2004 by webMethods All Rights Reserved.