perl, xpath and dtd

Discussion in 'Perl Misc' started by Marco, Feb 20, 2008.

  1. Marco

    Marco Guest

    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
    Marco, Feb 20, 2008
    #1
    1. Advertising

  2. Marco

    Guest

    On Feb 20, 11:13 am, Marco <> wrote:
    > 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;
    >


    <snip>

    > 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
    , Feb 22, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joseph Tilian
    Replies:
    0
    Views:
    339
    Joseph Tilian
    Dec 21, 2004
  2. Ronald Fischer
    Replies:
    4
    Views:
    1,742
    Ronald Fischer
    Mar 17, 2005
  3. Marvin_123456

    "Memory leak" in javax.xml.xpath.XPath

    Marvin_123456, Jul 29, 2005, in forum: Java
    Replies:
    4
    Views:
    1,954
    jan V
    Jul 29, 2005
  4. Alastair Cameron
    Replies:
    1
    Views:
    7,366
    SQL Server Development Team [MSFT]
    Jul 8, 2003
  5. test
    Replies:
    2
    Views:
    1,993
    Oliver Wong
    Jul 28, 2006
Loading...

Share This Page