-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
1.1.1, 1.2.0
-
generic
-
generic
Name: viR10068 Date: 04/30/2002
The 4.4 "XML Processor Treatment of Entities and References" of
XML 1.0 SE spec says that the ParameterEntity may be used in the
DTD and will be resolved as 'Included as PE' (see table).
But the parser failed to parse parameter entity in ATTLIST
(both crimson in JDK 1.4.1 and xerces in JAXP 1.2 build b18).
See the log below for details:
% cat xml_ex1.xml
<?xml version="1.0" ?>
<!DOCTYPE root [
<!ENTITY % text 'CDATA'>
<!ELEMENT root ANY>
<!ATTLIST root attr %text; 'attDefValue' >
]>
<root>data</root>
% cat xml_ex.java
import java.io.PrintStream;
import java.io.File;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.SAXParser;
import org.xml.sax.helpers.DefaultHandler;
public class xml_ex {
public static void main(String [] args) {
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);
SAXParser parser = spf.newSAXParser();
File xmlFile = new File(args[0]);
parser.parse(xmlFile, new DefaultHandler());
System.out.println("Passed.");
} catch (Exception e) {
e.printStackTrace();
System.out.println("Failed.");
}
}
}
% javac xml_ex.java && java -showversion xml_ex xml_ex1.xml
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b10)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b10, mixed mode)
org.xml.sax.SAXParseException: Parameter entity references must not appear within markup
declarations in the internal DTD subset.
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3182)
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3170)
at org.apache.crimson.parser.Parser2.getc(Parser2.java:3011)
at org.apache.crimson.parser.Parser2.maybeAttlistDecl(Parser2.java:2187)
at org.apache.crimson.parser.Parser2.maybeMarkupDecl(Parser2.java:1210)
at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Parser2.java:1144)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:489)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:442)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:281)
at xml_ex.main(xml_ex.java:36)
Failed.
%echo $CLASSPATH && /export/ld25/java/dest/jdk1.3.1/solsparc/bin/java -showversion xml_ex
xml_ex1.xml
/export/ld25/java/dest/JAXP/jaxp-1.2.0-fcs-b18-24_apr_2002/xalan.jar:.:/export/ld25/java/d
est/JAXP/jaxp-1.2.0-fcs-b18-24_apr_2002/jaxp-api.jar:/export/ld25/java/dest/JAXP/jaxp-1.2.
0-fcs-b18-24_apr_2002/xercesImpl.jar:/export/ld25/java/dest/JAXP/jaxp-1.2.0-fcs-b18-24_apr
_2002/sax.jar:
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
org.xml.sax.SAXParseException: The attribute type is required in the declaration of
attribute "attr" for element "root".
at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1162)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at xml_ex.main(xml_ex.java:36)
Failed.
%
======================================================================