Mantis - Resin
Viewing Issue Advanced Details
916 major always 02-06-06 00:35 04-06-06 11:07
GreenEyed  
ferg  
normal  
closed 3.0.17  
fixed  
none    
none 3.0.19  
0000916: Caucho's XML parser ignores encoding declaration in a DTD
In our applications, we have XML configuration files that are validated against a DTD, included in the jar of our library.
This DTD is encoded using ISO-8859-1 but upon startup of the application and when the XML parser reads the configuration file, it complains with the following message:
-----------------------------------------------------------------------------
java.io.CharConversionException: http://www.uib.es/leaf/LEAFwad.dtd:2: [^] illegal u
tf8 encoding at 0xf3
        at com.caucho.xml.readers.Utf8Reader.error(Utf8Reader.java:161)
        at com.caucho.xml.readers.Utf8Reader.readSecond(Utf8Reader.java:129)
        at com.caucho.xml.readers.Utf8Reader.read(Utf8Reader.java:91)
        at com.caucho.xml.readers.MacroReader.read(MacroReader.java:171)
        at com.caucho.xml.XmlParser.parseComment(XmlParser.java:1673)
        at com.caucho.xml.XmlParser.parseDoctypeDecl(XmlParser.java:560)
        at com.caucho.xml.XmlParser.parseDoctype(XmlParser.java:496)
        at com.caucho.xml.XmlParser.parseNode(XmlParser.java:386)
        at com.caucho.xml.XmlParser.parseInt(XmlParser.java:240)
        at com.caucho.xml.AbstractParser.parse(AbstractParser.java:633)
        at com.caucho.xml.AbstractParser.parseDocument(AbstractParser.java:817)
        at com.caucho.xml.parsers.AbstractDocumentBuilder.parse(AbstractDocument
Builder.java:63)
        at org.leaf.impl.TraxLoader.getDocument(TraxLoader.java:110)
        ......... // Custom code
-----------------------------------------------------------------------------
Checking the DTD, there are such ilegal UTF-8 characters, but they are valid ISO-8859-1 characters and the declaration of the DTD is
-----------------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1" ?>
...
-----------------------------------------------------------------------------
so it should not complain. In fact, Caucho's XML parser from versions 2.1.X do not complain, neither does Xerces, which is the parser we are using now due to this problem.

It's been happening since the first version I tested from the 3.X branch and it never happened with the 2.X branch.
You can find the "offending" DTD here:
https://webleaf.dev.java.net/source/browse/*checkout*/webleaf/resources/org/leaf/util/LEAFwad.dtd [^]

Notes
(0001030)
ferg   
04-06-06 11:07   
xml/00hb