[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] BUG with XMLproject on win NT/JDK1.1.x : Referencing an external entity
subject: BUG with XMLproject on win NT/JDK1.1.x : Referencing an external entity doesn't work if working with URL. Hello, I've just submitted the bug to Sun Bug parade. Can someone have a look and check if it's one ? Reproducing the bug is really easy and is explained above. Thank BUG DESCRIPTION ---------------------------------------------------------- Only on Windows NT and JDK1.1.x (no bug on Windows NT/JDK1.2.x or linux/jdk1.1.7 and Solaris/jdk1.1.6). If a Xml document references an external entity in its DTD, and if this Xml document is loaded into memory through an URL, then the parser won't resolve the correct URI to locate the external file that contains the external entity. REPRODUCING THE BUG ----------------------------------------------------------- To reproduce the bug, it's easy. All you need is : - Windows NT - any Jdk 1.1.x (for instance 1.1.8 from sun, installed at the location d:\java\jdk1.1.8) - XML projects TR2 (installed at the location d:\java\xml-tr2 in our case) Go in the 'simple' example of XML project (path : d:\java\xml-tr2\examples\simple). In the file 'main.java', replace the line 55 input = Resolver.createInputSource (new File (argv [0])); with the following : input = Resolver.createInputSource (new java.net.URL(argv[0]), false); Add the file 'doc.xml' in the 'simple' directory with the following lines : <?xml version="1.0"?> <!DOCTYPE root SYSTEM "entity.dtd"> <root> &entity_tag; </root> Add the file 'entity.dtd' in the 'simple' directory with the following line : <!ENTITY entity_tag "<example_tag><example_tag2/></example_tag>"> Add the file build2.bat in the 'simple' directory with the following content : set JAVA_HOME=d:\java\jdk1.1.8 set XML_DOC=file:/d:\java\xml-tr2\examples\simple\doc.xml %JAVA_HOME%\bin\javac -classpath ..\..\xml.jar;% JAVA_HOME% \lib\classes.zip main.java %JAVA_HOME%\bin\java -classpath .;..\..\xml.jar;%JAVA_HOME% \lib\classes.zip main %XML_DOC% Then launch 'build2.bat', you'll suppose to get the output : java.io.FileNotFoundException: \entity.dtd at java.io.FileInputStream.<init>(FileInputStream.java:56) at sun.net.www.protocol.file.FileURLConnection.connect(Compiled Code) at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLCon nection.java:162) at com.sun.xml.parser.Resolver.resolveEntity(Resolver.java:340) at com.sun.xml.parser.ExternalEntity.getInputSource(ExternalEntity.java: 46) at com.sun.xml.parser.Parser.pushReader(Parser.java:2748) at com.sun.xml.parser.Parser.externalParameterEntity(Compiled Code) at com.sun.xml.parser.Parser.maybeDoctypeDecl(Compiled Code) at com.sun.xml.parser.Parser.parseInternal(Compiled Code) at com.sun.xml.parser.Parser.parse(Parser.java:283) at com.sun.xml.tree.XmlDocument.createXmlDocument(XmlDocument.java:225) at main.main(main.java:60) OTHER ENVIRONMENTS ---------------------------------------------------- In Windows NT and JDK1.2.x, the simple works fine and the output is : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE root SYSTEM 'file:/d:/java/xml- tr2/examples/simple/entity.dtd'> <root> <example_tag> <example_tag2 /> </example_tag> </root> In Solaris with wathever JDK (1.1.x or 1.2.x) everything is fine. In Linux, same as solaris. xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1 To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|