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: Elliotte Harold <elharo AT metalab.unc.edu>
  • 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 13:56:44 -0500

On Mar 6, 2005, at 1:38 PM, Elliotte Harold wrote:

Andrew Thompson wrote:
Hi all,
I've been trying to use XOM as an XInclude resolver, so I wrote a little program to take some XHTML document I had and resolve the includes:

I'll have to look deeper, but I don't think the problem is line endings. Are you sure the input file is well-formed?

Continuing to dig into this. I think the file is well formed because the w3c validator is OK with it, plus, I altered my code to read like this:

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

OutputStream destFile = new BufferedOutputStream(new FileOutputStream(a_outputFile));
Serializer s = new Serializer(destFile, "UTF-8");

But the file still wouldn't go through when saved as UTF-8.
So finally I saved it as UTF-8 with no BOM, and the file goes through... which is odd. BOM on, exception, BOM off, goes through.

Well, when I say goes through, now I'm getting:

Resolving includes in /Volumes/Mesa/Stuff/website bits/index.xml to /Volumes/Mesa/Stuff/website bits/index.html
Illegal IRI in href attribute
nu.xom.xinclude.BadHrefAttributeException: Illegal IRI in href attribute
at nu.xom.xinclude.XIncluder.testURISyntax(Unknown Source)
at nu.xom.xinclude.XIncluder.resolve(Unknown Source)
at nu.xom.xinclude.XIncluder.resolve(Unknown Source)
at nu.xom.xinclude.XIncluder.resolve(Unknown Source)

But the only XInclude elements the document contains is:

<xi:include href="navbar.xml"/>
<xi:include href="sidebar.xml"/>

That error message could use some more detail, if possible!

So I'm left with three questions:

* what's up with my xinclude
* why does the BOM prevent the file from being handled
* Does anyone know a Java component that can guess the file encoding for an XML file?

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