Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

My dear brothers and sisters in Perl I beg your assistance,

I am lost in a twisty maze of TFM's and my little brain is overflowing. The answer must be there somewhere but I am going snowblind from staring at reams of virgin white manpages.

I am using SOAP to get some lists of events back from Tivoli Enterprise Portal (Formaly CandleNet Portal). If I dump the raw XML from SOAP::Lite with the option $soap -> outputxml(1) I get several rows of data, here is a reduced example ...
<?xml version="1.0" encoding="ISO-8859-1"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV=" +elope/" SOAP-ENV:encodingStyle=" +ding/"> <SOAP-ENV:Body><SOAP-CHK:Success xmlns:SOAP-CHK = "http://soa +ptest1/soaptest/" xmlns="urn:candle-soap:attributes"><TABLE name="KMQ +.QMEVENTC"> <OBJECT>Current_Events</OBJECT> <DATA> <ROW> <Origin_Node>TQTHSL1:HSL:MQ</Origin_Node> <Reporting_MQ_Manager_Name>TQTHSL1</Reporting_MQ_Manager_Name> <Reporting_Host_Name>hsl</Reporting_Host_Name> <Event_ID>C0000000</Event_ID> <Event dt="number">Channel_Stopped</Event> <Event_Date_and_Time>1050810083840000</Event_Date_and_Time> </ROW> <ROW> <Origin_Node>TQTHSL1:HSL:MQ</Origin_Node> <Reporting_MQ_Manager_Name>TQTHSL1</Reporting_MQ_Manager_Name> <Reporting_Host_Name>hsl</Reporting_Host_Name> <Event_ID>C0000001</Event_ID> <Event dt="number">Channel_Stopped</Event> <Event_Date_and_Time>1050810083842000</Event_Date_and_Time> </ROW> <ROW> <Origin_Node>TQTHSL1:HSL:MQ</Origin_Node> <Reporting_MQ_Manager_Name>TQTHSL1</Reporting_MQ_Manager_Name> <Reporting_Host_Name>hsl</Reporting_Host_Name> <Event_ID>C0000002</Event_ID> <Event dt="number">Channel_Stopped</Event> <Event_Date_and_Time>1050810083843000</Event_Date_and_Time> </ROW> </DATA> </TABLE> </SOAP-CHK:Success></SOAP-ENV:Body></SOAP-ENV:Envelope>

However when I remove the $soap -> outputxml(1) directive and let SOAP::Lite pass it off to the parser I only get the last row of data in the result (I am checking paramsout() as well, here is what I get back.

Got result: HASH(0x207f2ed8) $VAR1 = { 'OBJECT' => 'Current_Events', 'DATA' => { 'ROW' => { 'Event' => 'Channel_Stopped', 'Event_ID' => 'C0000002', 'MQ_Manager_Subsystem' => '', 'Event_Date_and_Time' => '1050810083843000', 'Reporting_Host_Name' => 'hsl', 'Origin_Node' => 'TQTHSL1:HSL:MQ', 'Reporting_MQ_Manager_Name' => 'TQTHSL1', 'Event_Host_Name' => 'hsl', 'Application_Identifier' => '', 'Event_MQ_Manager_Name' => 'TQTHSL1', } } }; Got paramsall: HASH(0x207f2ed8) Got paramsout:
Now it is obvious that all those <ROW> elements are writing over the top of the same hash key but how on earth do I go about fixing it ? I can think of the ugly option of clunking the raw XML to replace ROW with ROW$i++ then pass it on the thje parser, but I know that is a sin for which I will face eternal purgatory. Where should I look to fix this properly ?


Pereant, qui ante nos nostra dixerunt!

In reply to XML Parser clobbering Multiple occurances of element by Random_Walk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (2)
    As of 2018-07-19 04:36 GMT
    Find Nodes?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

      Results (402 votes). Check out past polls.