#1
  1. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,397
    Rep Power
    594

    XML::XPath and Finding Nodes


    I am not understanding how to use 'find' to locate the nodes that contain a specific entry. My first problem is that I don't know how to set up a XML::XPath object when I already have an XML object. I already have an XML::Simple object. Now I want to search that object for a list of nodes that contain a certain value. Here is my non-working code:
    Code:
    # The following method returns an XML::Simple object
    my $results=$mj->sendRequest("userSenderlist","GET",());
    my $xp=XML::XPath->new(xml=>$results)
    The resulting error is:

    not well-formed (invalid token) at line 1, column 4, byte 4:
    HASH(0x8b9e148)
    ===^
    at /usr/lib/perl5/XML/Parser.pm line 187.

    Obviously I can't just pass an XML object to XPath so how do I get this thing set up to use find? It seems to me that since I already have an XML object, I shouldn't need to convert it back to XML to get an XPath object. Perhaps I missed something in the documentation but I could not find any examples that start with an XML object rather than an XML string or file. TIA.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,397
    Rep Power
    594
    Rats! Wrong forum. I'd swear I was in the perl forum tab when I posted this. Too many tabs open in the same venue I guess. Since there is no red triangle, I need a mod to move this.
    Last edited by gw1500se; April 17th, 2013 at 09:40 AM.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 2003
    Posts
    3,397
    Rep Power
    594
    Never, mind. I've switched to a different module and reformatted the question in the perl forum as new.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.

IMN logo majestic logo threadwatch logo seochat tools logo