Project

Profile

Help

Capturing XML Validation Messages for XSLT

Added by Anonymous almost 15 years ago

Legacy ID: #7466962 Legacy Poster: W. Eliot Kimber (drmacro)

I'm using the S9API to do XSLT processing. I've successfully integrated my own MessageListener that logs to an arbitrary apache commons logging log. What I can't figure out how to do is to do the same thing for the XML parser the XSLT processor is using, so that I can capture any XML parsing errors to the same log. In my case, the log is passed in as a parameter to the transformer request, so I can't just use a class name and have it be constructed dynamically. In looking through the code samples and walking down into DocumentBuilder I'm getting a bit lost in the weeds and I'm pretty sure I'm missing something fairly simple. What am I missing? Thanks, Eliot


Replies (2)

RE: Capturing XML Validation Messages for XSLT - Added by Anonymous almost 15 years ago

Legacy ID: #7466985 Legacy Poster: Michael Kay (mhkay)

If you supply the input in the form of a SAXSource, then you can preconfigure the XMLReader contained in the SAXSource. Saxon won't change the configuration of the XMLReader unless it has to (for example, it has to set the ContentHandler and LexicalHandler). If you leave Saxon to create the XMLReader (which happens for example if you pass a StreamSource) then you have no control over how it is configured. Another option, however, is to nominate as your SourceParserClass an implementation of XMLReader of your own, which might be a subclass or wrapper for a "mainstream" XMLReader, that preconfigures it on initialization.

RE: Capturing XML Validation Messages for XSLT - Added by Anonymous almost 15 years ago

Legacy ID: #7468202 Legacy Poster: W. Eliot Kimber (drmacro)

Ah, that makes sense. I will explore the SAXSource approach. Thanks, Eliot

    (1-2/2)

    Please register to reply