|
XML for Java Compatibility API 2.0.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.xml.parser.NOOPVisitor | +--com.ibm.xml.parser.MakeDigestVisitor
MakeDigestVisitor implements the Visitor interface in the visitor design pattern for the purpose of calculating and storing a digest on the various DOM- and XML4J-defined Nodes as the document object tree is traversed. Digests are calculated usng the message digest passed on the constructor.
Digests can be made for the following Node types:
The following sample code uses the MakeDigestVisitor on a hierarchy of nodes:
MakeDigestVisitor makeDigestVisitor = new MakeDigestVisitor(this.getFactory().createMessageDigest()); new NonRecursivePreorderTreeTraversal(makeDigestVisitor).traverse(this);
Visitor
,
NOOPVisitor
,
TreeTraversal
,
NonRecursivePreorderTreeTraversal
Field Summary | |
protected java.security.MessageDigest |
messageDigest
|
Constructor Summary | |
MakeDigestVisitor(java.security.MessageDigest messageDigest)
Constructor. |
Method Summary | |
static java.lang.String |
getExpandedName(org.w3c.dom.Node node)
|
void |
visitAttributePre(TXAttribute attribute)
Calculates and sets a digest for the specified attribute. |
void |
visitCommentPre(TXComment comment)
Calculates and sets a digest for the specified comment. |
void |
visitElementPost(TXElement element)
Calculates and sets a digest for the specified element. |
void |
visitElementPre(TXElement element)
If the specified element already has a calculated digest, throw an exception to avoid unnecessary traversal of children. |
void |
visitGeneralReferencePre(GeneralReference generalReference)
Do nothing. |
void |
visitPIPre(TXPI pi)
Calculates and sets a digest for the specified pi. |
void |
visitTextPre(TXText text)
Calculates and sets a digest for the specified text. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected java.security.MessageDigest messageDigest
Constructor Detail |
public MakeDigestVisitor(java.security.MessageDigest messageDigest)
messageDigest
- Message digest instance to use when visitting.TXDocument.createMessageDigest()
Method Detail |
public void visitElementPre(TXElement element) throws java.lang.Exception
element
- Node to calculate and set a digest.TXElement
,
visitElementPost(com.ibm.xml.parser.TXElement)
public void visitElementPost(TXElement element) throws java.lang.Exception
A digest of a TXElement Node consists of its:
String#compareTo()
).
element
- Node to calculate and set a digest.UnicodeBigUnmarked
encoding,
or the JVM does not have the required security providers
for the message digest.TXElement
,
visitElementPre(com.ibm.xml.parser.TXElement)
public void visitAttributePre(TXAttribute attribute) throws java.lang.Exception
A digest of a TXAttribute Node consists of its Node type, its name, and its value.
Note that TXAttribute Nodes are not parsed into the document object hierarchy by the XML4J parser; attributes exist as part of a TXElement Node.
attribute
- Node to calculate and set a digest.UnicodeBigUnmarked
encoding,
or the JVM does not have the required security providers
for the message digest.TXAttribute
public void visitPIPre(TXPI pi) throws java.lang.Exception
A digest of a TXPI Node consists of its Node type, its name, and its data.
pi
- Node to calculate and set a digest.UnicodeBigUnmarked
encoding,
or the JVM does not have the required security providers
for the message digest.TXPI
public void visitCommentPre(TXComment comment) throws java.lang.Exception
A digest of a TXComment Node consists of its Node type and its data.
comment
- Node to calculate and set a digest.UnicodeBigUnmarked
encoding,
or the JVM does not have the required security providers
for the message digest.TXComment
public void visitTextPre(TXText text) throws java.lang.Exception
A digest of a TXText Node consists of its Node type and its data.
text
- Node to calculate and set a digest.UnicodeBigUnmarked
encoding,
or the JVM does not have the required security providers
for the message digest.TXText
public void visitGeneralReferencePre(GeneralReference generalReference) throws java.lang.Exception
public static java.lang.String getExpandedName(org.w3c.dom.Node node)
|
XML for Java Compatibility API 2.0.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |