Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Having a really bad time, and I fear it's all line endings

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Andrew Thompson <lordpixel AT mac.com>
  • To: Andrew Thompson <lordpixel AT mac.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Having a really bad time, and I fear it's all line endings
  • Date: Sun, 6 Mar 2005 14:58:58 -0500


On Mar 6, 2005, at 1:56 PM, Andrew Thompson wrote:

* what's up with my xinclude
* why does the BOM prevent the file from being handled

In answer to John Cowan's point: I'm using the default parser from JDK 1.4.2. This would be Xerces 2.X, right?

Regarding the other two points:

I changed my code back to using the File object directly:

// InputStream fis = new FileInputStream(a_inputFile);
// Reader r = new BufferedReader(new InputStreamReader(fis, "UTF-8"));
Builder b = new Builder();
Document unresolved = b.build(a_inputFile);

Well, now it seems to handle the UTF-8 fine, and the xincludes resolve OK.
This makes sense, because if I initialize the Builder from a Reader, I guess I should be using the build(Reader, String encoding) version so it knows how to resolve the includes. So call me the class dunce.

However, I think the XIncluder needs to be a little smarter so as to give better error messages.
If a Document is created using a Builder with a Reader or an InputStream, and a base URI is not given, then it would seem to me that the XIncluder is going to fail for that Document. So perhaps the Document needs to hold some state that indicates it's not a valid target for XInclude processing? Then the XIncluder could give a better error message?

AndyT (lordpixel - the cat who walks through walls)
A little bigger on the inside

(see you later space cowboy ...)





Archive powered by MHonArc 2.6.24.

Top of Page