Estoy batallando un poquito al tratar de recibir datos en XML dentro de un script en Perl y estoy un poco confundido.
Estoy utilizando XML::Simple, con la instrucción XLMin();
Mi Script es el siguiente :
Using perl Syntax Highlighting
use strict;
print "Content-type:text/html\n\n";
use XML::Simple;
$xml = new XML::Simple ();
$reservas = $xml->XMLin();
$action = $reservas->{action};
$propid = $reservas->{PropertyID};
$propname = $reservas->{PropertyName};
$chaincode = $reservas->{ChainCode};
# ... y asi sucesivamente armo la estructura de datos para Perl.
print "Content-type:text/html\n\n";
use XML::Simple;
$xml = new XML::Simple ();
$reservas = $xml->XMLin();
$action = $reservas->{action};
$propid = $reservas->{PropertyID};
$propname = $reservas->{PropertyName};
$chaincode = $reservas->{ChainCode};
# ... y asi sucesivamente armo la estructura de datos para Perl.
Coloreado en 0.003 segundos, usando GeSHi 1.0.8.4
Esta es la estructura de datos que me envian :
Using xml Syntax Highlighting
<?xml version='1.0'?>
<gkxml>
<export_version>0.7</export_version>
<export_type>travelly</export_type>
<export_date>20061113</export_date>
<action>newres</action>
<GroupID id='travelly'>
<GroupName>Omega</GroupName>
<ChainCode id='Delta'>
<ChainName>Delta Hotels</ChainName>
<PropertyID id='KJG6689'>
<PropertyName>Omega Spa Resort</PropertyName>
<PropertyExtID></PropertyExtID>
<AgentID id='1'>
<AgentCode>DIRECT</AgentCode>
<AgentIATA>DIREC</AgentIATA>
<AgentCTA>Direct Client</AgentCTA>
<AffiliateAgentCode>delta</AffiliateAgentCode>
<GuestReservationDetails>
<GuestID id='2507'>
<PNR>2507</PNR>
<Title>Mr.</Title>
<FirstName>Trent</FirstName>
<LastName>Zagorsky</LastName>
<Address>8385 Frederick Court </Address>
<City>De Soto</City>
<ProvState>ks</ProvState>
<Country>United States</Country>
<PostcodeZip>66018</PostcodeZip>
<Telephone>9139098299</Telephone>
<Fax></Fax>
<Email>[email protected]</Email>
<CompanyName></CompanyName>
<Nationality></Nationality>
<PassportNumber></PassportNumber>
<MembershipNumber></MembershipNumber>
<Membership></Membership>
<MailingList>yes</MailingList>
<Language>en</Language>
<ReservationID id='3373'>
<ReservationNumber>GK3373</ReservationNumber>
<ReservationStatus>Confirmed On-Line</ReservationStatus>
<ArriveDate>20070125</ArriveDate>
<DepartDate>20070130</DepartDate>
<RateCode>KRGVJRS</RateCode>
<RateCodeName>Jacuzzi Jr. Suite</RateCodeName>
<RateCodeType>Internet Rate</RateCodeType>
<RoomClass>Junior Suite</RoomClass>
<NumberRooms>1</NumberRooms>
<NumberOfNights>5</NumberOfNights>
<Currency>USD</Currency>
<RoomCost>2000</RoomCost>
<TaxType>included</TaxType>
<GuestNames>Zagorsky, Mr. Trent</GuestNames>
<Adults>2</Adults>
<Children>0</Children>
<Infants>0</Infants>
<RoomPreference>Double</RoomPreference>
<SmokingPreference>Non Smoking</SmokingPreference>
<Comments></Comments>
<ArriveMode>Air</ArriveMode>
<ArriveDetails>Frontier #46 arrive 10:40am</ArriveDetails>
<ArriveTransfer>no</ArriveTransfer>
<DepartureMode></DepartureMode>
<DepartureDetails></DepartureDetails>
<DepartureTransfer>no</DepartureTransfer>
<RateInclusions>Gourmet Inclusive features: All meals, unlimited domestic & selected intl. premium alcoholic & non-alcoholic drinks, day/night activity program, non motorized watersports, scuba diving clinic in pool, live music & shows, use of bicycles, fitness center, sauna & steam room, day/night tennis, room service, in room minibar replenished daily, welcome glass of sparkling wine, all taxes & gratuities. </RateInclusions>
<SpecialDates></SpecialDates>
<ReservationEntered>2006-11-13 22:24:57</ReservationEntered>
</ReservationID>
</GuestID>
<AgentMessage></AgentMessage>
<Currency>USD</Currency>
<BookingAmount>2000</BookingAmount>
<DepositPaid>200.00</DepositPaid>
<DepositPaidDate>20061113</DepositPaidDate>
<RemainderAmount>1800</RemainderAmount>
<RemainderDueDate>20061115</RemainderDueDate>
<PaymentGateway>YOURPAY</PaymentGateway>
<PaymentTransactionID>48800FC3-455937</PaymentTransactionID>
</GuestReservationDetails>
</AgentID>
</PropertyID>
</ChainCode>
</GroupID>
</gkxml>
<gkxml>
<export_version>0.7</export_version>
<export_type>travelly</export_type>
<export_date>20061113</export_date>
<action>newres</action>
<GroupID id='travelly'>
<GroupName>Omega</GroupName>
<ChainCode id='Delta'>
<ChainName>Delta Hotels</ChainName>
<PropertyID id='KJG6689'>
<PropertyName>Omega Spa Resort</PropertyName>
<PropertyExtID></PropertyExtID>
<AgentID id='1'>
<AgentCode>DIRECT</AgentCode>
<AgentIATA>DIREC</AgentIATA>
<AgentCTA>Direct Client</AgentCTA>
<AffiliateAgentCode>delta</AffiliateAgentCode>
<GuestReservationDetails>
<GuestID id='2507'>
<PNR>2507</PNR>
<Title>Mr.</Title>
<FirstName>Trent</FirstName>
<LastName>Zagorsky</LastName>
<Address>8385 Frederick Court </Address>
<City>De Soto</City>
<ProvState>ks</ProvState>
<Country>United States</Country>
<PostcodeZip>66018</PostcodeZip>
<Telephone>9139098299</Telephone>
<Fax></Fax>
<Email>[email protected]</Email>
<CompanyName></CompanyName>
<Nationality></Nationality>
<PassportNumber></PassportNumber>
<MembershipNumber></MembershipNumber>
<Membership></Membership>
<MailingList>yes</MailingList>
<Language>en</Language>
<ReservationID id='3373'>
<ReservationNumber>GK3373</ReservationNumber>
<ReservationStatus>Confirmed On-Line</ReservationStatus>
<ArriveDate>20070125</ArriveDate>
<DepartDate>20070130</DepartDate>
<RateCode>KRGVJRS</RateCode>
<RateCodeName>Jacuzzi Jr. Suite</RateCodeName>
<RateCodeType>Internet Rate</RateCodeType>
<RoomClass>Junior Suite</RoomClass>
<NumberRooms>1</NumberRooms>
<NumberOfNights>5</NumberOfNights>
<Currency>USD</Currency>
<RoomCost>2000</RoomCost>
<TaxType>included</TaxType>
<GuestNames>Zagorsky, Mr. Trent</GuestNames>
<Adults>2</Adults>
<Children>0</Children>
<Infants>0</Infants>
<RoomPreference>Double</RoomPreference>
<SmokingPreference>Non Smoking</SmokingPreference>
<Comments></Comments>
<ArriveMode>Air</ArriveMode>
<ArriveDetails>Frontier #46 arrive 10:40am</ArriveDetails>
<ArriveTransfer>no</ArriveTransfer>
<DepartureMode></DepartureMode>
<DepartureDetails></DepartureDetails>
<DepartureTransfer>no</DepartureTransfer>
<RateInclusions>Gourmet Inclusive features: All meals, unlimited domestic & selected intl. premium alcoholic & non-alcoholic drinks, day/night activity program, non motorized watersports, scuba diving clinic in pool, live music & shows, use of bicycles, fitness center, sauna & steam room, day/night tennis, room service, in room minibar replenished daily, welcome glass of sparkling wine, all taxes & gratuities. </RateInclusions>
<SpecialDates></SpecialDates>
<ReservationEntered>2006-11-13 22:24:57</ReservationEntered>
</ReservationID>
</GuestID>
<AgentMessage></AgentMessage>
<Currency>USD</Currency>
<BookingAmount>2000</BookingAmount>
<DepositPaid>200.00</DepositPaid>
<DepositPaidDate>20061113</DepositPaidDate>
<RemainderAmount>1800</RemainderAmount>
<RemainderDueDate>20061115</RemainderDueDate>
<PaymentGateway>YOURPAY</PaymentGateway>
<PaymentTransactionID>48800FC3-455937</PaymentTransactionID>
</GuestReservationDetails>
</AgentID>
</PropertyID>
</ChainCode>
</GroupID>
</gkxml>
Coloreado en 0.002 segundos, usando GeSHi 1.0.8.4
Aparentemente sólo recibo el campo <action>newres</action> que queda almacenado en $action.
Mi pregunta es, ¿ cómo debería de estructurar la info, porque como verán tiene varias etiquetas de grupo ?
De antemano, muchas gracias por su atención,
Caribesoft