Loading ...
Sorry, an error occurred while loading the content.

96Non-unique values

Expand Messages
  • Johnson, Keith
    Mar 6, 2001
    • 0 Attachment
      Non-unique values

      Has anyone run across a scenario where you need to parse out non-unique named XML elements such as <addressOption> listed below.  When I parse the hash that is returned only the last <addressOption> is available.  Any thoughts on how to be able to parse or loop through all of the available elements ?

      XML Document Returned from SOAP API Call.

                      <Name>Frank Smith</Name>
                      <Address1>12 Maple Avenue</Address1>
                      <Address2>Apt. 12</Address2>
                      <City>Fantasy Island</City>
                      <name>ABC Inc</Name>
                      <address1>12 Maple Avenue</Address1>
                      <address2>Att: Frank Smith</Address2>
                      <city>Fantasy Island</City>

      $data=SOAP::Data      ->encodingStyle('http://xml.apache.org/xml-soap/literalxml')
                            ->name('SendOrder' => \%param );

      $hash = $soap->SendOrder($data)->valueof('//addressOptionList');
      %hash2 = %{$hash->{'addressOption'}};

      $description= $hash2{'description'};
      $name           = $hash2{'name'};
      $address1       = $hash2{'address1'};
      $address2       = $hash2{'address2'};
      $city           = $hash2{'city'};
      $state  = $hash2{'state'};
      $zipCode        = $hash2{'zipCode'};


    • Show all 3 messages in this topic