You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Amthauer, Heiner" <He...@t-systems.com> on 2002/10/16 09:00:34 UTC

EntityResolver (was: Error parsing files, when filename contains german umlauts)

Hi again!

(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?

greetings
Heiner

-----Ursprüngliche Nachricht-----
Von: Amthauer, Heiner 
Gesendet am: Freitag, 11. Oktober 2002 09:28
An: 'Xerces'
Betreff: Error parsing files, when filename contains german umlauts

Hi there!

(Using Xerces 2.0.2, JRE 1.3.1_02)

I discovered an error, when parsing xml files when their name contains
german umlauts. The call to the SAXParser is:

saxParser.parse(new File(file), this);

As one can see, the File(...) itself is created before the parser is called.
One should assume, that the parser does not care about the filename.
However, when parsing the file, I get the following exception:

java.net.MalformedURLException: no protocol: GBB_Datenmodell.dtd
        at java.net.URL.<init>(Unknown Source)
        at java.net.URL.<init>(Unknown Source)
        at java.net.URL.<init>(Unknown Source)
        at
org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:79
6)
        at
org.apache.xerces.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java
:756)
        at
org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.ja
va:267)
        ....

By renaming the file, avoiding umlauts (not touching the files contents),
the file can be parsed perfectly nice.

One way to solve this is by not using german umlauts. However, our customer
will not accept the fact that he should have such restrictions on a windows
system, nowadays.

I would appreciate any hint about solving this problem.

regards
Heiner

---------------------------------------------------------------
Dipl. Ing. Heiner Amthauer

T-Systems GEI GmbH

Hausanschrift: Magirusstr. 39/1, 89077 Ulm
Postanschrift: Postfach 20 64, 89010 Ulm
Telefon: +49 ( 731) 9344-4422
Telefax: +49 (731) 9344-4409
Mobil: +49 (1 78) 4269335
E-Mail: heiner.amthauer@t-systems.com
Internet: http://www.t-systems.com



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org