[jdom-interest] Validation bug reading XML from URI and not from a characterStream?
arosen at silverstream.com
Mon Jun 3 06:56:14 PDT 2002
I think that some parsers accept "c:\myfile.xml" as a URI even though it's
not. It's better to use a real URI that starts with "file:". Use the toURL()
method on java.io.File.
> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Sergio Sierra
> Sent: Thursday, May 30, 2002 2:52 PM
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] Validation bug reading XML from URI and not
> from a characterStream?
> I have a strange behaviour with JDOM b8 when I trying to build a JDOM
> tree from URI, for example ("c:\myfile.xml").
> CASE A:
> If the same file is into a String variable (as characterStream) the
> validation against the DTD is correct: if there was an error
> in the data
> or in the DTD, the exception is thrown and i know the file is
> invalid o
> CASE B:
> However, if try to parse the same XML file with the same
> content and the
> same DTD directly from my hard disk (URI = "c:\myfile.xml"), the
> validation is not run, so the JDOM tree is built in memory and the
> exception to know if the file is invalid is not thrown. So if i have a
> wrong XML file, i can't know it because the JDOM tree was built in
> memory like it was a valid XML file.
> I have tryed to set some features, without result.
> There are the code lines I use (problem persists without
> String XMLfile = "<?xml version=\"1.0\"
> String XMLuri= "c:\myfile.xml";
> builder = new
> ternal-dtd", true);
> CASE A: validation against DTD is correct if the xml is built from a
> doc = builder.build(new StringReader(XMLfile));
> CASE B: validation is off if the xml file is built from a URI, so JDOM
> tree is created if the file is invalid
> doc = builder.build(XMLuri);
> Please, anyone have any idea of the problem?
> Thanks for your help,
> P.D. I have used Xerces 1.4.4 and Xerces 2.0.1 and the
> problem persists.
> To control your jdom-interest membership:
uraddr at yourhost.com
More information about the jdom-interest