XML::DOM::ValParser Could not load DTD

S

saket.raizada

In my XML file i have a heading like
<!DOCTYPE system_health SYSTEM
"file://C:\eclipse\XMLCodeV2\SystemHealth.dtd">

My program tries to check the XML file against DTD by doing a

my %expat_options = (KeepCDATA => 1,
Handlers => [ Unparsed => \&my_Unparsed_handler
],);
my $parser = new XML::DOM::ValParser (%expat_options);
eval {
local $XML::Checker::FAIL = \&my_fail;
$doc = $parser->parsefile ("$xml_file");
};

When i run the program it says.
..
C:\eclipse\XMLCodeV2\SystemHealth.xml failed validation!
Couldn't find external DTD
[file://C:\eclipse\XMLCodeV2\SystemHealth.dtd], may
e you should set SGML_SEARCH_PATH at
PERL2EXE_STORAGE/XML/Checker/Parser.pm lin
383.

If i add the entry
$parser->set_sgml_search_path("C:\\eclipse\\XMLCodeV2");
to set the sgml path then it fails with error
C:\eclipse\XMLCodeV2\SystemHealth.xml failed validation!
Couldn't load URL [file:C:\eclipse\XMLCodeV2/SystemHealth.dtd] with
LWP: panic URI.pm line 92.

Anyone has an example how to load external DTD on Windows machine ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top