It does sound like there's some container issue about loading this document.
Can you read the file using a regular FileReader()? If so you could pass the
FileReader into the SAXReader().

James
----- Original Message -----
From: "Mark Derricutt" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 12, 2002 11:20 PM
Subject: [dom4j-user] XML file has no top-element.


> Hi, as part of my webapp I'm using Dom4J to parse an XML file, the Dom4J
> jars are part of my WEB-INF/lib directory.
>
> When I upgraded my resin 2.0.5 install to the new 2.1.0 release, I now get
> the following on startup:
>
> 2002-05-03 14:10:22,774 ERROR td.jtime  - Error parsing XML:
> file:/c:/resin/webapps/jtime/WEB-INF/jtime_modules.xml:1: XML file has no
> top-element.  All well-formed XML files have a single top-level element.
> Nested exception:
file:/c:/resin/webapps/jtime/WEB-INF/jtime_modules.xml:1:
> XML file has no top-element.  All well-formed XML files have a single
> top-level element.
>
> org.dom4j.DocumentException:
> file:/c:/resin/webapps/jtime/WEB-INF/jtime_modules.xml:1: XML file has no
> top-element.  All well-formed XML files have a single top-level element.
> Nested exception:
file:/c:/resin/webapps/jtime/WEB-INF/jtime_modules.xml:1:
> XML file has no top-element.  All well-formed XML files have a single
> top-level element.
>         at org.dom4j.io.SAXReader.read(SAXReader.java:342)
>         at org.dom4j.io.SAXReader.read(SAXReader.java:218)
>
>
> Mmmm, I also notice a lack of a standalone.exe in the 2.1.0 zip file...???
>
> Does anyone have any idea what might cause this?
>
> I'm reading my XML with the following code:
>
>   String prefix = getServletContext().getRealPath("/");
>   ModuleDefinition.getModuleList( prefix +
>     getInitParamete("jtime_modules")));
>
>   // in ModuleDefinition.getModuleList() (modulesList is passed in)
>   File file = new File(modulesList);
>   SAXReader reader = new SAXReader();
>   Document document = reader.read(file);
>
> I found in some previous posts (to either the dom4j or resin lists)
someone
> mentioned getting around the problem by using...
>
>   URL url = file.toURL();
>   Document document = reader.read(url.openStream());
>
> ...but that didn't work for me.
>
> Any one know what might cause this?
>
>
>
>
>                                    -- \m/ --
>   "...if I seem super human I have been misunderstood." (c) Dream Theater
>           [EMAIL PROTECTED] - ICQ: 1934853 JID: [EMAIL PROTECTED]
>
> _______________________________________________________________
>
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to