Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] How to check for DTD file associated with XML file?

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: sarika ture <sarika.ture AT gmail.com>
  • Cc: XOM forum <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] How to check for DTD file associated with XML file?
  • Date: Fri, 11 Feb 2005 03:13:12 -0500

sarika ture wrote:

For that i tried following code,
builder = new Builder();
Document doc = builder.build("c:\\howto.xml");

C:\\howto.xml is not a legal URL. Therefore XOM can't find it. Try file://c:/howto.xml or some such (My Windows is a little rusty.)


"nu.xom.ParsingException: Document root element is missing. at
line 1, column -1.

at nu.xom.Builder.build(Builder.java:675)
at nu.xom.Builder.build(Builder.java:445)
at NodeLister.<init>(NodeLister.java:24)
at NodeLister.main(NodeLister.java:14)
nu.xom.ParsingException: Document root element is missing. at line 1,
column -1. "

That's not the exception I'd expect to see here. Either the problem is not what I think it is, or the exception message is off, or the code isn't what you said it was. Line 675 is inside a method you're not calling (build(File)) so I expect the latter. By any chance is what the code really says:

Document doc = builder.build(new File("c:\\howto.xml"));

If so, the problem is simple. The file is malformed.

--
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