Parsing emoty fields XML using perl

Alok Sharma <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
Hi,

I need some tips to parse some piece of xml using perl (both depicted below). I need to extract the TOPNAME and MAPREF fields. Please suggest.

Thanks,
Alok

The XML code is :
<TEST:component xmlns:ip="IP" xmlns:nx="IP" xmlns:s="1.2" xmlns:xsi="nstance">
  <TEST:vendor>VENDOR</TEST:vendor>
  <TEST:library>nxCtoIp</TEST:library>
  <TEST:name>NAME</TEST:name>
  <TEST:version>4.1.0</TEST:version>
  <TEST:busInterfaces>
    <TEST:busInterface TEST:id="MYID" TEST:resolve="user">
        <TEST:name>MYNAME</TEST:name>
        <TEST:busType TEST:library="nxCtoBus" TEST:name="TOPNAME" TEST:vendor="VENDOR" TEST:version="1.0"/>
        <TEST:slave>
        <TEST:AMAPRef TEST:AMAPRef="MAPREF"/>
        </TEST:slave>
        <TEST:connection>required</TEST:connection>
        <TEST:signalMap>


Perl code I tried :

foreach my $component ($ipxml->getElementsByTagName('TEST:component')) {
  my $cname = ($component->getElementsByTagName('TEST:name'))[0]->getFirstChild->getData();
  &log("component name = $cname\n") if $debug;
  print FILENAME "// Component = $cname\n";

  MAPS : foreach my $busInterface ($component->getElementsByTagName('TEST:busInterface')) {
    my $busname = ($busInterface->getElementsByTagName('TEST:name'))[0]->getFirstChild->getData();
    my $bustype = ?? Need to get TOPNAME ???
   
   ??? Also need to get MAPREF somehow ???

_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.