[jdom-interest] Validation bug reading XML from URI and not from a characterStream?
stephan at ncube.de
Mon Jun 3 07:28:40 PDT 2002
Did you try the URI file:///c:/myfile.xml ?
On Thu, May 30, 2002 at 08:51:32PM +0200, Sergio Sierra wrote:
> 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 builder.setXXXX
> 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:
Stephan Trebels <stephan at ncube.de>, Consultant
mail: nCUBE Deutschland GmbH, Hanauer Str. 56, 80992 Munich, Germany
phone: +49 89 149893 0 cell: +49 172 8433111 fax: +49 89 149893 50
More information about the jdom-interest