Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6649347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:45:47+00:00 2026-05-26T00:45:47+00:00

I would like your help in the following : given the .xml file :

  • 0

I would like your help in the following :

given the .xml file :

<network>
    <netelement>
            <node pwd="KOR-ASBG" func="describe_SBG_TGC">
                    <collection category="IMT" dir="Stream_statistics"></collection>
                                    </node>
    </netelement>
    <netelement>
            <node pwd="ADR-ASBG" func="describe_SBG_TGC">
                    <collection category="IMT" dir="Stream_statistics"></collection>
                    <collection category="IMT" dir="Proxy_registrar_statistics_ACCESS"></collection>
            </node>
    </netelement></network>

What I would like to do is to get the element with the attribute “KOR-ASBG”, for example,
but using only XPath.

I have written the following Perl code :

#!/usr/bin/perl         -w

use             strict ;
use             warnings ;
use             XML::LibXML ;
use             Data::Dump qw(dump) ;


my $dump = "/some_path/_NETELEMENT_.xml" ;
my $parser = new XML::LibXML ; my $doc ;
eval{ $doc = $parser->parse_file($dump) ; } ;
if( !$doc ) { print "failed to parse $dump" ; next ; }
my $root = $doc->getDocumentElement ;

my $_demo = $root->find('/network/netelement/node[@pwd="KOR-ASBG"]') ;
print dump($_demo)."\n" ;

But, what it gets dispalyed is :

bless([bless(do{\(my $o = 155172440)}, "XML::LibXML::Element")], "XML::LibXML::NodeList")

So the question would be, how can I get the XML Element that contains the “pwd” attribute (that equals “KOR-ASBG”), using XPath ?

Thank you 🙂

PS. I have also tried :

my @_demo = $root->findnodes('/network/netelement/node[@pwd="KOR-ASBG"]') ;
print dump(@_demo)."\n" ;

and what it gets displayed is :

bless(do{\(my $o = 179552448)}, "XML::LibXML::Element")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:45:48+00:00Added an answer on May 26, 2026 at 12:45 am

    Your dumper object is not lying to you; you are getting a node list. To access it you may either iterate through it or just access the first node:

    print $_demo->get_node(0)->toString()
    

    Of course, all DOM methods are available to you once you get the actual node:

    print $_demo->get_node(0)->getAttribute('func');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please I would like your help with the following issue: This is a sample
I would like your help, because I am not able to understand what the
I would like your help on something, I have a Table: InitialMatrix[x_, y_, age_,
I'm new for both Sonar and Weld/CDI. I would like your help to advise
I would like to invite your considered opinion to help me decide between the
I would like your guidance on how to create classes and their relationships (generalization,
I would like your advice about how best to solve my problem. In a
I would just like your feedback on something. Basically I have a value called
This seems like a silly question but I would really like your comments and
I would like to know your experience when you need to take over somebody

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.