How to parse an HTTP file with Xerces-Perl

Discussion in 'XML' started by Francesco Moi, Nov 13, 2004.

  1. Hi.

    I'm trying to parse a HTTP file
    http://www.foo.com/foo.xml
    by using Xerces-Perl:

    ------------------------------------------
    use XML::Xerces;

    my $file = XML::Xerces::LocalFileInputSource->new("http://www.foo.com/foo.xml");
    my $parser = XML::Xerces::XercesDOMParser->new();
    eval { $parser->parse($file); };
    error($@,"Couldn't parse file: $ARGV[0]") if $@;
    my $doc = $parser->getDocument();
    ---------------------------------------------

    But I'm not able. I get this error message:
    ----------------------------
    Can't call method "getDocumentElement" on an undefined value at
    parse_url.pl line 7.
    ---------------------------

    What am I doing wrong? Thank you very much.
    Francesco Moi, Nov 13, 2004
    #1
    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. Pascal Lagass?
    Replies:
    2
    Views:
    795
    Pascal Lagass?
    Mar 1, 2004
  2. CTowers
    Replies:
    0
    Views:
    983
    CTowers
    Apr 4, 2004
  3. Jim Cobban

    Xerces parse aborted on IOError

    Jim Cobban, Dec 5, 2003, in forum: XML
    Replies:
    0
    Views:
    394
    Jim Cobban
    Dec 5, 2003
  4. cvissy
    Replies:
    0
    Views:
    603
    cvissy
    Nov 16, 2004
  5. heiko
    Replies:
    0
    Views:
    1,049
    heiko
    Oct 1, 2005
Loading...

Share This Page