Hello,
 
I found these lines in the dom4j src dir for SaxReader.java
Pls look at the comment section..It may pertain to ur problem...
 
    /** <p>Reads a Document from the given <code>File</code></p>
      *
      * @param file is the <code>File</code> to read from.
      * @return the newly created Document instance
      * @throws DocumentException if an error occurs during parsing.
      * @throws MalformedURLException if a URL could not be made for the given File
      */
    public Document read(File file) throws DocumentException, MalformedURLException {
        try {
            /*
             * We cannot convert the file to an URL because if the filename
             * contains '#' characters, there will be problems with the
             * URL in the InputSource (because a URL like
             * http://myhost.com/index#anchor is treated the same as
             * http://myhost.com/index)
             * Thanks to Christian Oetterli
             */
            return read( new InputSource(new FileReader(file)) );
        } catch (FileNotFoundException e) {
            throw new MalformedURLException(e.getMessage());
        }
    }
 
THanks,
Naveen
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Billy Ng
Sent: Wednesday, June 25, 2003 8:41 PM
To: [EMAIL PROTECTED]
Subject: [dom4j-user] Content is not allowed in prolog

Hi folks,
 
When I try to use Dom4j to read the file with "#" in the path, it will throw the following exception.
 
org.dom4j.DocumentException: Error on line 1 of document file:/C:/Program Files/../../../#l/settings.xml: Content is not allowed in prolog. Nested exception: Content is not allowed in prolog.
        at org.dom4j.io.SAXReader.read(SAXReader.java:339)
        at org.dom4j.io.SAXReader.read(SAXReader.java:218)
 
The exception says "Content is not allowed in prolog", but I am sure everything is legal in the xml.  It works if I change the "#" to a letter in the path.
 
Why?
 
Billy Ng

Reply via email to