Skip to Content.
Sympa Menu

xom-interest - [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: sarika ture <sarika.ture AT gmail.com>
  • To: XOM forum <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] How to check for DTD file associated with XML file?
  • Date: Fri, 11 Feb 2005 09:43:07 +0530

Hi all,
I want to check wheather a XML file has specific
DTD file associated with it.

I want to parse only those XML file that have
"measurement.dtd" file
associated with it.
For that i tried following code,

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

if(doc.getDocType().getSystemID()!=null)
if(!doc.getDocType().getSystemID().equals("MeasurementStat.dtd"))
{
System.out.println("dtd is different");
}

It is giving following exception,

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

so can anybody tell me how to do that.

bye,
have a nice day!




Archive powered by MHonArc 2.6.24.

Top of Page