perl, xpath and dtd

M

Marco

Hi all,
first of all I'm non a perl-expert: I just code in perl some times...

I'm coding a tool to analyze the xml created by the websphere
performance servlet but I'm having problems with dtd documents...

This is my code:

use XML::XPath;
use XML::XPath::XMLParser;
use LWP::UserAgent;
use HTTP::Request;

my $ua = LWP::UserAgent->new;
my $url ="http://address";
my $jdbc_driver = "DB2 Universal JDBC Driver Provider";

my $req = HTTP::Request->new(GET => $url);
my $response = $ua->request($req);
my $content = $response->content();

my $xpath="/PerformanceMonitor/Node/Server/Stat/Stat/CountStatistic/
\@count";

if ($response->is_success) {
$xp = XML::XPath->new(ioref => $content );
my $nodeset = $xp->findnodes($xpath);
foreach my $node ($nodeset->get_nodelist){
print XML::XPath::XMLParser::as_string($node);
}
}


I get this output



[mstrullato@vm01 ~]$ perl ./query_was.pl
404 File `/wasPerfTool/dtd/performancemonitor.dtd' does not exist
file:///wasPerfTool/dtd/performancemonitor.dtd
Handler couldn't resolve external entity at line 8, column 160, byte
703
error in processing external entity reference at line 8, column 160,
byte 703:
<!-- not published or otherwise divested of its trade secrets,
irrespective -->
<!-- of what has been deposited with the U.S. Copyright
Office. -->
<!--
****************************************************************************--
<!DOCTYPE PerformanceMonitor SYSTEM "/wasPerfTool/dtd/
performancemonitor.dtd">
===============================================================================================================================================================^

<PerformanceMonitor responseStatus="success" version="6.1.0.13">
at /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/XML/
Parser.pm line 187



I can see that the problem is the dtd document that is not found: the
code is looking to the dtd into filesystem and not from the correct
location...


Could you help me?
Hou should I change my code?


Thanks


Marco
 
S

sheinrich

Hi all,
first of all I'm non a perl-expert: I just code in perl some times...

I'm coding a tool to analyze the xml created by the websphere
performance servlet but I'm having problems with dtd documents...

This is my code:

use XML::XPath;
use XML::XPath::XMLParser;
use LWP::UserAgent;
use HTTP::Request;

at /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/XML/
Parser.pm line 187

I can see that the problem is the dtd document that is not found: the
code is looking to the dtd into filesystem and not from the correct
location...

Well, XML::XPath::XMLParser subclasses XML::parser.
You ought to read up on DTD inclusion and your specific errors in the
XML::parser docs.

steffen
 

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
474,034
Messages
2,570,356
Members
47,002
Latest member
RobertoLip

Latest Threads

Top