Hi there! Well, if the saxParser would behave like you have pointed out, I would have a bunch of other questions. However, your answer gave me the right hint. As shown below, I did use the method saxParser.parse(file, handler) and my content handler is derived from DefaultHandler. Since the DefaultHandler implements an EntityResolver, the setting setEntityResolver(...) is ignored. Now, all I had to do was overriding the method resolveEntity(...) and that's it.
Thanx for your patients. greetings Heiner -----Urspr�ngliche Nachricht----- Von: Sander Bos [mailto:[EMAIL PROTECTED] Gesendet am: Mittwoch, 16. Oktober 2002 14:36 An: [EMAIL PROTECTED] Betreff: RE: EntityResolver (was: Error parsing files, when filename contains german umlauts) 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
