[Omaha.pm] XML::Twig get_xpath()

Jay Hannah jay at jays.net
Mon Aug 13 11:56:46 PDT 2007


get_xpath is wicked cool.   :)

j


BEFORE:

   } elsif ($message_type =~ /HotelResNotif/) {

     my $HRs = $twig->first_child("HotelReservations");
     goto BARF if (!$HRs);
     my $HR = $HRs->first_child("HotelReservation");
     goto BARF if (!$HR);
     my $RSs = $HR->first_child("RoomStays");
     goto BARF if (!$RSs);
     my $RS = $RSs->first_child("RoomStay");
     goto BARF if (!$RS);
     my $BPI = $RS->first_child("BasicPropertyInfo");
     goto BARF if (!$BPI);
     $HotelCode = $BPI->att("HotelCode");

AFTER:

    } elsif ($message_type =~ /HotelResNotif/) {
       my (@x) = $twig->get_xpath('HotelReservations/HotelReservation/ 
RoomStays/RoomStay/BasicPropertyInfo');
       $HotelCode = $x[0]->att("HotelCode") if ($x[0]);


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/omaha-pm/attachments/20070813/088591e5/attachment.html 


More information about the Omaha-pm mailing list