Volker Katz wrote:
I have to validate a SAX-stream against a XML-Schema. My plan was to
implement a custom ContentHandler which sends all SAX-events to the
parser. Therefore I used an instance of
org.apache.xerces.parsers.SAXParser, because this class implements
alls SAX-events.
So I created an SAXParser and set the following features and
properties:
[...]
Then I implemented start-/endDocument and start-/endElement of my
DocumentHandler. In this methods I called: parser.startElement(...),
parser.endElement(...)....
I don't think that this will work. The Xerces SAXParser parses
input streams, not SAX streams. The fact that the SAXParser
implements XMLDocumentHandler (which is similar to ContentHandler)
does *not* mean that you can route SAX events to it. The parser
class is the *end* of the parsing process, not the beginning.
However...
We designed XNI to be modular. So it is possible to replace the
scanner at the beginning of the pipeline with a SAX->XNI converter
that routes your SAX-stream to the subsequent stages in the
pipeline (e.g. XML Schema validator, etc). You would need to
write your own parser configuration for this setup, though.
This type of parser configuration has not been written for Xerces,
yet, but I wrote the SAX->XNI converter component for a previous
project. If you want to try to implement this configuration, let
me know and I'll point you to that code. And, if you do write it,
it would be great if you could donate it back to the project so
that other people can use it.
--
Andy Clark * [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]