I have the following implementation task and I have no good idea how to solve it.
We have a SAX-based syntax-checker for a xml format that checks a hashsum in some closing endElement(). This hashsum is built using a kind of filtering InputStream that updates a MessageDigest while reading the content. The SAX-syntaxchecker uses this inputstream as its InputSource.
The problem (my task) is, that the hashsum should be built over some canonicalized parts of the input xml (see http://www.w3.org/TR/xml-c14n).
Now the tricky thing: We have a Canonicalizer that also uses SAX to canonicalize the input. (It needs to be aware of the current context to distinguish between attributes and nodes etc, thats why we use SAX)
I want to reuse that Canonicalizer but I see no way how to combine these two SAX-parsers.
I think I want some kind of pipelining:
InputFile -> Canonicalizer -> HashCalculation-InputStream -> SyntaxChecker.
Any ideas/references how to accomplish that? TIA.