Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Problem with Xerces/XOMHandler.inInternalSubset reading from File but not FileReader or FileInputStream

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT ibiblio.org>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] Problem with Xerces/XOMHandler.inInternalSubset reading from File but not FileReader or FileInputStream
  • Date: Mon, 14 Sep 2009 15:00:12 -0400

On Mon, Sep 14, 2009 at 2:37 PM, Peter Murray-Rust <pm286 AT cam.ac.uk> wrote:

The second thing that jumps out at me is that the first two of these
do not have a base URL. To XOM they appear to be pure streams:

>        Document doc = new Builder().build(new FileReader("b511922g.xml"));
>        System.out.println("worked with filereader");
>
>        FileInputStream fis= new FileInputStream(new File("b511922g.xml"));
>        doc = new Builder().build(fis);
>        System.out.println("worked with FileInputStream");
>
>         File f = new File("b511922g.xml");
>         System.out.println(f.getAbsolutePath());
>         doc = new Builder().build(new File("b511922g.xml"));

However from this 3rd one, XOM can call f.toURL() to derive a base URL
for the document. That may have something to do with why this one and
only this one fails.

Since you're using a relative path, that can be very tricky,
especially on Windows. By any chance are the runs that fail on a
different platform than the ones that suceed?

> I am surprised that changing from a FileReader to a File generated the
> error, and also that it appears to come from the Internal Subset. It is not
> easy to generate this error message on demand since it is not thrown on my
> machine. I suspect it is a Xerces problem that may be very difficult to
> track down. We assume we are working with the Xerces packaged in the JRE
> since we have stripped all jars from the classpath.

I'm not ready to blame Xerces yet. I'll need to look at XOM's own code
when I get home.

--
Elliotte Rusty Harold
elharo AT ibiblio.org




Archive powered by MHonArc 2.6.24.

Top of Page