Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Builder argument swap

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: jcowan AT reutershealth.com
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Builder argument swap
  • Date: Mon, 22 Mar 2004 10:31:24 -0500

At 1:27 PM -0500 3/19/04, jcowan AT reutershealth.com wrote:

No, I think you have it correct already. Conceptually, the build()
multimethod takes two arguments, a source and an optional base URI.
Currently, the source can be a File, an InputStream, a Reader, a system
ID (represented as a String), or a String. Since the last two have
the same representation, you're forced to make the base URI prohibited
when the source is a system ID (which is reasonable) and required when
the source is a String (which is also reasonable, as there is no way to
deduce the base URI of a String). There is no obvious reason, though,
why a base URI can't be set when the source is a File.


My thought is that the File object provides its own base URI. If you pass a File object the base URI will be set on the resulting document. This isn't true for a plain input stream created from a file. Plus, I'd rather not ask the user to specify a file URI if they don't really want to change the location. file URIs are very tricky and platform dependent, and it's easy to get them wrong. I'm not sure the File.toURL() method actually does get them right, but I suspect it does a better job than mot users are likely to do by rolling their own. Since the most common case is that the base URI is the URI of the file itself, that's what XOM supports.
--

Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA




Archive powered by MHonArc 2.6.24.

Top of Page