You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Stef Epardaud <st...@lunatech.com> on 2003/03/27 14:21:21 UTC

How to access parsed grammars while receiving SAX events from SAXParser ?

Hello,

I want to access the schema grammars while getting SAX events from a
SAXParser. I currently access these grammars by providing my own
XMLGrammarPool to the parser, which then caches the grammars in there
and lets me access them. Is there another way or a better/preferred way ?
The problem I have is that in XMLSchemaValidator the grammars are only
cached in the XMLGrammarPool in handleEndElement() so for those declared
at the root element: at the end of the document. Which makes them
unaccessible for me during the parsing process.

I have found that attempting to cache them in XMLSchemaValidator.findSchema()
solves my problem. Is this acceptable ?
Here is my patch in case you appreciate the feature.
-- 
# Stef Epardaud, # Teachers have potentially more power than military,
# Java Defeater  #   the former can teach us how to not need the latter.
#     Earth      # Lunatech Research,
#  Solar System  #   soon we'll quit researching and start finding...