Hi Heiner,

> (Xerces 2.0.2, JRE1.3.1)
> 
> I discovered, that the early mentioned problem can be nicely 
> avoided, when
> using an entity resolver. I set the resolver with the following code:
> 
> ...
> org.xml.sax.SAXParser saxParser =
> SAXParserFactory.newInstance().newSAXParser();
> ...
> saxParser.getXMLReader().setEntityResolver(new MyEntityResolver());
> saxParser.parse(file, this);
> 
> However, using this code, the instance of MyEntityResolver is 
> never accessed
> in any way. Whats wrong?

Since you ask it every 5 minutes, let me as a lurker make an attempt to
answer your question. I notice that you set the entity resolver on the
xml-reader but parse on the parser. Perhaps you could try

XMLReader myReader = saxParser.getXMLReader();
myReader.setEntityResolver(new MyEntityResolver());
myReader.setContentHandler(this);
myReader.parse(file);

or something like that.

I did not try this (although our entity resolvers in Xerces work like a
charm), but looking at the Xerces source code for 5 seconds (so not a
definite answer) I would say saxParser.parse(...) does not use the xml
reader object on which you set the entity resolver.

Kind regards,

--Sander.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to