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: Peter Murray-Rust <pm286 AT cam.ac.uk>
  • To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
  • Cc: Daniel Lowe <dl387 AT cam.ac.uk>
  • Subject: Re: [XOM-interest] Problem with Xerces/XOMHandler.inInternalSubset reading from File but not FileReader or FileInputStream
  • Date: Mon, 14 Sep 2009 21:07:25 +0100

Many thanks for both messages.

FWIW the problem occurred with a larger document which had an Internal
subset but we stripped it down for copyright reasons :-( .

On Mon, Sep 14, 2009 at 8:00 PM, Elliotte Rusty Harold
<elharo AT ibiblio.org>wrote:

> 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");
>

We did this for ease of running and possibly reproducing. BTW we both work
on Windows. However we are also having refactoring done remotely and they
have also seen the problem


> >
> > 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?
>

Daniel (my coworker) and I are both on Windows. I'll check the OS. We'll try
to collect info further info and can do experiments if required

>
> > 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.
>

Thanks. It looks like we can avoid the problem with FileInputStream but it
is important to be safe.

P.

>
>
--
Peter Murray-Rust
Reader in Molecular Informatics
Unilever Centre, Dep. Of Chemistry
University of Cambridge
CB2 1EW, UK
+44-1223-763069




Archive powered by MHonArc 2.6.24.

Top of Page