Skip to Content.
Sympa Menu

xom-interest - Re: [SPAM] [XOM-interest] Question about Base URI

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: Arjan Huijzer <huijzer AT gmail.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [SPAM] [XOM-interest] Question about Base URI
  • Date: Thu, 18 Nov 2004 10:06:38 -0500

Arjan Huijzer wrote:

Why is this second parameter necessary? Can't the parser deduct the
base URI from the filename of the XML file?


You're passing in an InputStream, not a File object. Therefore XOM has no way of telling what the location or name of the corresponding file is. (It would be nice if FileInputStream had a getURI() or getFile() method but it doesn't.)) Therefore it's looking in the current working directory rather than the one from the File object. Try this instead:

Builder parser = new Builder();
File input = new File("c:/temp/person.xml");
Document doc = parser.build(input);

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




Archive powered by MHonArc 2.6.24.

Top of Page