Hi Bruce
If ever you're having trouble finding and loading a document, you could try
just using standard java.io.* classes to read it first and see if that
works. e.g. does this work...
BufferedReader in
= new BufferedReader( new FileReader( ENGLISH_STAGING_FILE));
String line = in.readLine();
If you can get that far, i.e. you are capable of opening and reading from
the file on your environment then you can just pass in the Reader to the
SAXReader. e.g.
BufferedReader in
= new BufferedReader( new FileReader( ENGLISH_STAGING_FILE));
SAXReader saxReader = new SAXReader();
Document doc = saxReader.read( in );
And that should just work. I hope that helps - let us know how you get on.
James
----- Original Message -----
From: "Bruce Ritchie" <[EMAIL PROTECTED]>
To: "James Strachan" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, September 12, 2001 2:50 PM
Subject: RE: [dom4j-user] SAXReader throwing org.dom4j.DocumentException
> > This seems kinda wierd - it seems like its not finding the file. I'm not
> > sure if it'll make much difference but does changing this line...
> >
> > > SAXReader reader = new SAXReader();
> > > Document doc = reader.read(new File(ENGLISH_STAGING_FILE));
> >
> > To
> >
> > Document doc = reader.read(ENGLISH_STAGING_FILE);
> >
> > make any difference?
>
> Unfortunately, no. I've even gone so far as to put a dummy xml file on my
> local HD (the other drive was a samba mount) and try with that, same
result.
> The sample xml file is below, no problems there.
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <publishing>
> <make></make>
> </publishing>
>
>
> The code I'm using is below - I've even added testing to print out the xml
> file to System.err, which prints just fine. I'm at a loss to explain the
> problem, I was really hoping to use dom4j since the xpath integration
would
> be very useful for me.
>
>
> SAXReader reader = new SAXReader();
> Document doc = null;
>
> if (language.equals(FRENCH) && version.equals(STAGING)) {
> doc = reader.read(new File(FRENCH_STAGING_FILE));
> }
> else if (language.equals(ENGLISH) && version.equals(STAGING)) {
> doc = reader.read(new File(ENGLISH_STAGING_FILE));
> }
> else if (language.equals(FRENCH) && version.equals(PRODUCTION)) {
> doc = reader.read(new File(FRENCH_PRODUCTION_FILE));
> }
> else if (language.equals(ENGLISH) && version.equals(PRODUCTION)) {
> if (!(new File(ENGLISH_PRODUCTION_FILE)).exists()) {
> System.err.println("not exist");
> }
> else {
> System.err.println("exists");
> BufferedReader br = new BufferedReader(new
> FileReader(ENGLISH_PRODUCTION_FILE));
> String line = "";
> while ((line=br.readLine()) != null) {
> System.err.println(line);
> }
> br.close();
> }
> doc = reader.read(new File(ENGLISH_PRODUCTION_FILE));
> }
>
>
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user