Parses XML response into array.

This is what reads the response XML and converts it into an array.
@param SimpleXMLElement $xml <p>The XML response from Amazon.</p>
@return boolean <b>FALSE</b> if no XML data is found
484635
protected function parseXML($xml) {
        if (!$xml){
            return false;
        }
        $i = 0;
        foreach($xml->children() as $x){
            $this->previewList[$i]['ShippingSpeedCategory'] = (string)$x->ShippingSpeedCategory;
            $this->previewList[$i]['IsFulfillable'] = (string)$x->IsFulfillable;
            $this->previewList[$i]['IsCODCapable'] = (string)$x->IsCODCapable;
            $this->previewList[$i]['MarketplaceId'] = (string)$x->MarketplaceId;
            if (isset($x->EstimatedShippingWeight)){
                $this->previewList[$i]['EstimatedShippingWeight']['Unit'] = (string)$x->EstimatedShippingWeight->Unit;
                $this->previewList[$i]['EstimatedShippingWeight']['Value'] = (string)$x->EstimatedShippingWeight->Value;
            }
            if (isset($x->FulfillmentPreviewShipments)){
                $j = 0;
                foreach ($x->FulfillmentPreviewShipments->children() as $y){
                    $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['LatestShipDate'] = (string)$y->LatestShipDate;
                    $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['LatestArrivalDate'] = (string)$y->LatestArrivalDate;
                    $k = 0;
                    foreach ($y->FulfillmentPreviewItems->children() as $z){
                        $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['EstimatedShippingWeight']['Unit'] = (string)$z->EstimatedShippingWeight->Unit;
                        $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['EstimatedShippingWeight']['Value'] = (string)$z->EstimatedShippingWeight->Value;
                        $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['SellerSKU'] = (string)$z->SellerSKU;
                        $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['SellerFulfillmentOrderItemId'] = (string)$z->SellerFulfillmentOrderItemId;
                        $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['ShippingWeightCalculationMethod'] = (string)$z->ShippingWeightCalculationMethod;
                        $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['FulfillmentPreviewItems'][$k]['Quantity'] = (string)$z->Quantity;
                        $k++;
                    }
                    $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['EarliestShipDate'] = (string)$y->EarliestShipDate;
                    $this->previewList[$i]['FulfillmentPreviewShipments'][$j]['EarliestArrivalDate'] = (string)$y->EarliestArrivalDate;
                    $j++;
                }
            }
            if (isset($x->EstimatedFees)){
                $j = 0;
                foreach ($x->EstimatedFees->children() as $y){
                    $this->previewList[$i]['EstimatedFees'][$j]['CurrencyCode'] = (string)$y->Amount->CurrencyCode;
                    $this->previewList[$i]['EstimatedFees'][$j]['Value'] = (string)$y->Amount->Value;
                    $this->previewList[$i]['EstimatedFees'][$j]['Name'] = (string)$y->Name;
                    $j++;
                }
            }
            if (isset($x->UnfulfillablePreviewItems)){
                $j = 0;
                foreach ($x->UnfulfillablePreviewItems->children() as $y){
                    $this->previewList[$i]['UnfulfillablePreviewItems'][$j]['SellerSKU'] = (string)$y->SellerSKU;
                    $this->previewList[$i]['UnfulfillablePreviewItems'][$j]['SellerFulfillmentOrderItemId'] = (string)$y->SellerFulfillmentOrderItemId;
                    $this->previewList[$i]['UnfulfillablePreviewItems'][$j]['Quantity'] = (string)$y->Quantity;
                    $this->previewList[$i]['UnfulfillablePreviewItems'][$j]['ItemUnfulfillableReasons'] = (string)$y->ItemUnfulfillableReasons;
                    $j++;
                }
            }
            if (isset($x->OrderUnfulfillableReasons)){
                $j = 0;
                foreach ($x->OrderUnfulfillableReasons->children() as $y){
                    $this->previewList[$i]['OrderUnfulfillableReasons'][$j] = (string)$y;
                    $j++;
                }
            }
            if (isset($x->ScheduledDeliveryInfo)){
                $this->previewList[$i]['ScheduledDeliveryInfo']['DeliveryTimeZone'] = (string)$x->ScheduledDeliveryInfo->DeliveryTimeZone;
                foreach ($x->ScheduledDeliveryInfo->DeliveryWindows->children() as $y){
                    $temp = array();
                    $temp['StartDateTime'] = (string)$y->DeliveryWindow->StartDateTime;
                    $temp['EndDateTime'] = (string)$y->DeliveryWindow->EndDateTime;
                    $this->previewList[$i]['ScheduledDeliveryInfo']['DeliveryWindows'][] = $temp;
                }
            }
            
            $i++;
        }
    }
1048943
protected function xml2object($xml)
    {
        $envelope = simplexml_load_string(
            $xml,
            'SimpleXMLElement',
            0,
            'http://schemas.xmlsoap.org/soap/envelope/'
        );

        foreach ($envelope->Body as $response) {
            $children = $response->children(static::XML_NAMESPACE);
            foreach ($children as $item) {
                return $item;
            }
        }

        throw new Exception('XML from gateway could not be parsed');
    }
1181285
protected function parseXml($xml) {
        if (!$xml){
            return false;
        }

        //response from send, confirm, estimate, void
        if (isset($xml->TransportDocument)) {
            $this->doc = (string)$xml->TransportDocument->PdfDocument;
            $this->checksum = (string)$xml->TransportDocument->Checksum;
        }
    }
473723
protected function parseXML($xml){
        $this->serviceList = array();
        $this->downList = array();
        $this->termsList = array();
        if (!$xml){
            return false;
        }
        if (isset($xml->ShippingServiceList)) {
            $i = 0;
            foreach($xml->ShippingServiceList->children() as $key=>$x){
                if ($key != 'ShippingService'){
                    break;
                }

                $this->serviceList[$i]['ShippingServiceName'] = (string)$x->ShippingServiceName;
                $this->serviceList[$i]['CarrierName'] = (string)$x->CarrierName;
                $this->serviceList[$i]['ShippingServiceId'] = (string)$x->ShippingServiceId;
                $this->serviceList[$i]['ShippingServiceOfferId'] = (string)$x->ShippingServiceOfferId;
                $this->serviceList[$i]['ShipDate'] = (string)$x->ShipDate;
                if (isset($x->EarliestEstimatedDeliveryDate)) {
                    $this->serviceList[$i]['EarliestEstimatedDeliveryDate'] = (string)$x->EarliestEstimatedDeliveryDate;
                }
                if (isset($x->LatestEstimatedDeliveryDate)) {
                    $this->serviceList[$i]['LatestEstimatedDeliveryDate'] = (string)$x->LatestEstimatedDeliveryDate;
                }
                $this->serviceList[$i]['Rate']['Amount'] = (string)$x->Rate->Amount;
                $this->serviceList[$i]['Rate']['CurrencyCode'] = (string)$x->Rate->CurrencyCode;
                $this->serviceList[$i]['ShippingServiceOptions']['DeliveryExperience'] = (string)$x->ShippingServiceOptions->DeliveryExperience;
                $this->serviceList[$i]['ShippingServiceOptions']['CarrierWillPickUp'] = (string)$x->ShippingServiceOptions->CarrierWillPickUp;
                if (isset($x->ShippingServiceOptions->DeclaredValue)) {
                    $this->serviceList[$i]['ShippingServiceOptions']['DeclaredValue']['Amount'] = (string)$x->ShippingServiceOptions->DeclaredValue->Amount;
                    $this->serviceList[$i]['ShippingServiceOptions']['DeclaredValue']['CurrencyCode'] = (string)$x->ShippingServiceOptions->DeclaredValue->CurrencyCode;
                }
                if (isset($x->AvailableLabelFormats)) {
                    foreach ($x->AvailableLabelFormats as $z) {
                        $this->serviceList[$i]['AvailableLabelFormats'][] = (string)$z;
                    }
                }

                $i++;
            }
        }
        if (isset($xml->TemporarilyUnavailableCarrierList)) {
            $i = 0;
            foreach($xml->TemporarilyUnavailableCarrierList->children() as $key=>$x){
                if ($key != 'TemporarilyUnavailableCarrier'){
                    break;
                }

                $this->downList[$i] = (string)$x->CarrierName;
                $i++;
            }
        }
        if (isset($xml->TermsAndConditionsNotAcceptedCarrierList)) {
            $i = 0;
            foreach($xml->TermsAndConditionsNotAcceptedCarrierList->children() as $key=>$x){
                if ($key != 'TermsAndConditionsNotAcceptedCarrier'){
                    break;
                }

                $this->termsList[$i] = (string)$x->CarrierName;
                $i++;
            }
        }
    }
720362
protected function parseXml($xml){
        if (!$xml){
            return false;
        }

        $this->productList = array();
        if (!isset($xml->FeesEstimateResultList)){
            return;
        }
        foreach($xml->FeesEstimateResultList->children() as $x){
            $temp = array();
            $temp['MarketplaceId'] = (string)$x->FeesEstimateIdentifier->MarketplaceId;
            $temp['IdType'] = (string)$x->FeesEstimateIdentifier->IdType;
            $temp['IdValue'] = (string)$x->FeesEstimateIdentifier->IdValue;
            $temp['ListingPrice'] = $this->parseMoney($x->FeesEstimateIdentifier->PriceToEstimateFees->ListingPrice);
            if (isset($x->FeesEstimateIdentifier->PriceToEstimateFees->Shipping)){
                $temp['Shipping'] = $this->parseMoney($x->FeesEstimateIdentifier->PriceToEstimateFees->Shipping);
            }
            if (isset($x->FeesEstimateIdentifier->PriceToEstimateFees->Points->PointsNumber)){
                $temp['Points'] = (string)$x->FeesEstimateIdentifier->PriceToEstimateFees->Points->PointsNumber;
            }
            $temp['IsAmazonFulfilled'] = (string)$x->FeesEstimateIdentifier->IsAmazonFulfilled;
            $temp['SellerInputIdentifier'] = (string)$x->FeesEstimateIdentifier->SellerInputIdentifier;
            $temp['TimeOfFeesEstimation'] = (string)$x->FeesEstimateIdentifier->TimeOfFeesEstimation;
            $temp['Status'] = (string)$x->Status;
            if (isset($x->FeesEstimate)){
                $temp['TotalFeesEstimate'] = $this->parseMoney($x->FeesEstimate->TotalFeesEstimate);
                $temp['FeeDetailList'] = array();
                if (isset($x->FeesEstimate->FeeDetailList)){
                    foreach($x->FeesEstimate->FeeDetailList->children() as $z){
                        $temp['FeeDetailList'][] = $this->parseFeeDetail($z);
                    }
                }
            }
            if (isset($x->Error)){
                $temp['Error']['Type'] = (string)$x->Error->Type;
                $temp['Error']['Code'] = (string)$x->Error->Code;
                $temp['Error']['Message'] = (string)$x->Error->Message;
            }
            $this->productList[] = $temp;
        }
    }
1141594
protected function parseXML($xml){
        if (!$xml){
            return false;
        }
        
        foreach($xml->children() as $item){
            $n = $this->index;
            
            $this->itemList[$n]['ASIN'] = (string)$item->ASIN;
            $this->itemList[$n]['SellerSKU'] = (string)$item->SellerSKU;
            $this->itemList[$n]['OrderItemId'] = (string)$item->OrderItemId;
            $this->itemList[$n]['Title'] = (string)$item->Title;
            $this->itemList[$n]['QuantityOrdered'] = (string)$item->QuantityOrdered;
            if (isset($item->QuantityShipped)){
                $this->itemList[$n]['QuantityShipped'] = (string)$item->QuantityShipped;
            }
            if (isset($item->BuyerCustomizedInfo->CustomizedURL)){
                $this->itemList[$n]['BuyerCustomizedInfo'] = (string)$item->BuyerCustomizedInfo->CustomizedURL;
            }
            if (isset($item->PointsGranted)){
                $this->itemList[$n]['PointsGranted']['PointsNumber'] = (string)$item->PointsGranted->PointsNumber;
                $this->itemList[$n]['PointsGranted']['Amount'] = (string)$item->PointsGranted->PointsMonetaryValue->Amount;
                $this->itemList[$n]['PointsGranted']['CurrencyCode'] = (string)$item->PointsGranted->PointsMonetaryValue->CurrencyCode;
            }
            if (isset($item->PriceDesignation)){
                $this->itemList[$n]['PriceDesignation'] = (string)$item->PriceDesignation;
            }
            if (isset($item->GiftMessageText)){
                $this->itemList[$n]['GiftMessageText'] = (string)$item->GiftMessageText;
            }
            if (isset($item->GiftWrapLevel)){
                $this->itemList[$n]['GiftWrapLevel'] = (string)$item->GiftWrapLevel;
            }
            if (isset($item->ItemPrice)){
                $this->itemList[$n]['ItemPrice']['Amount'] = (string)$item->ItemPrice->Amount;
                $this->itemList[$n]['ItemPrice']['CurrencyCode'] = (string)$item->ItemPrice->CurrencyCode;
            }
            if (isset($item->ShippingPrice)){
                $this->itemList[$n]['ShippingPrice']['Amount'] = (string)$item->ShippingPrice->Amount;
                $this->itemList[$n]['ShippingPrice']['CurrencyCode'] = (string)$item->ShippingPrice->CurrencyCode;
            }
            if (isset($item->GiftWrapPrice)){
                $this->itemList[$n]['GiftWrapPrice']['Amount'] = (string)$item->GiftWrapPrice->Amount;
                $this->itemList[$n]['GiftWrapPrice']['CurrencyCode'] = (string)$item->GiftWrapPrice->CurrencyCode;
            }
            if (isset($item->ItemTax)){
                $this->itemList[$n]['ItemTax']['Amount'] = (string)$item->ItemTax->Amount;
                $this->itemList[$n]['ItemTax']['CurrencyCode'] = (string)$item->ItemTax->CurrencyCode;
            }
            if (isset($item->ShippingTax)){
                $this->itemList[$n]['ShippingTax']['Amount'] = (string)$item->ShippingTax->Amount;
                $this->itemList[$n]['ShippingTax']['CurrencyCode'] = (string)$item->ShippingTax->CurrencyCode;
            }
            if (isset($item->GiftWrapTax)){
                $this->itemList[$n]['GiftWrapTax']['Amount'] = (string)$item->GiftWrapTax->Amount;
                $this->itemList[$n]['GiftWrapTax']['CurrencyCode'] = (string)$item->GiftWrapTax->CurrencyCode;
            }
            if (isset($item->ShippingDiscount)){
                $this->itemList[$n]['ShippingDiscount']['Amount'] = (string)$item->ShippingDiscount->Amount;
                $this->itemList[$n]['ShippingDiscount']['CurrencyCode'] = (string)$item->ShippingDiscount->CurrencyCode;
            }
            if (isset($item->PromotionDiscount)){
                $this->itemList[$n]['PromotionDiscount']['Amount'] = (string)$item->PromotionDiscount->Amount;
                $this->itemList[$n]['PromotionDiscount']['CurrencyCode'] = (string)$item->PromotionDiscount->CurrencyCode;
            }
            if (isset($item->CODFee)){
                $this->itemList[$n]['CODFee']['Amount'] = (string)$item->CODFee->Amount;
                $this->itemList[$n]['CODFee']['CurrencyCode'] = (string)$item->CODFee->CurrencyCode;
            }
            if (isset($item->CODFeeDiscount)){
                $this->itemList[$n]['CODFeeDiscount']['Amount'] = (string)$item->CODFeeDiscount->Amount;
                $this->itemList[$n]['CODFeeDiscount']['CurrencyCode'] = (string)$item->CODFeeDiscount->CurrencyCode;
            }
            if (isset($item->PromotionIds)){
                $i = 0;
                foreach($item->PromotionIds->children() as $x){
                    $this->itemList[$n]['PromotionIds'][$i] = (string)$x;
                    $i++;
                }
            }
            if (isset($item->InvoiceData)){
                if (isset($item->InvoiceData->InvoiceRequirement)){
                    $this->itemList[$n]['InvoiceData']['InvoiceRequirement'] = (string)$item->InvoiceData->InvoiceRequirement;
                }
                if (isset($item->InvoiceData->BuyerSelectedInvoiceCategory)){
                    $this->itemList[$n]['InvoiceData']['BuyerSelectedInvoiceCategory'] = (string)$item->InvoiceData->BuyerSelectedInvoiceCategory;
                }
                if (isset($item->InvoiceData->InvoiceTitle)){
                    $this->itemList[$n]['InvoiceData']['InvoiceTitle'] = (string)$item->InvoiceData->InvoiceTitle;
                }
                if (isset($item->InvoiceData->InvoiceInformation)){
                    $this->itemList[$n]['InvoiceData']['InvoiceInformation'] = (string)$item->InvoiceData->InvoiceInformation;
                }
            }
            if (isset($item->ConditionId)){
                $this->itemList[$n]['ConditionId'] = (string)$item->ConditionId;
            }
            if (isset($item->ConditionSubtypeId)){
                $this->itemList[$n]['ConditionSubtypeId'] = (string)$item->ConditionSubtypeId;
            }
            if (isset($item->ConditionNote)){
                $this->itemList[$n]['ConditionNote'] = (string)$item->ConditionNote;
            }
            if (isset($item->ScheduledDeliveryStartDate)){
                $this->itemList[$n]['ScheduledDeliveryStartDate'] = (string)$item->ScheduledDeliveryStartDate;
            }
            if (isset($item->ScheduledDeliveryEndDate)){
                $this->itemList[$n]['ScheduledDeliveryEndDate'] = (string)$item->ScheduledDeliveryEndDate;
            }
            $this->index++;
        }
            
    }
41424
protected function loadXML($xml)
	{
		$this->checkUnsupported($xml);

		// Activate small nodes allocation and relax LibXML's hardcoded limits if applicable. Limits
		// on tags can be set during configuration
		$flags = (LIBXML_VERSION >= 20700) ? LIBXML_COMPACT | LIBXML_PARSEHUGE : 0;

		$useErrors = libxml_use_internal_errors(true);
		$dom       = new DOMDocument;
		$success   = $dom->loadXML($xml, $flags);
		libxml_use_internal_errors($useErrors);

		if (!$success)
		{
			throw new InvalidArgumentException('Cannot load XML: ' . libxml_get_last_error()->message);
		}

		return $dom;
	}
954345
protected function parseXML($xml) {
        if (!$xml || !$xml->Shipment){
            return false;
        }
        $d = $xml->Shipment;
        $this->data['ShipmentId'] = (string)$d->ShipmentId;
        $this->data['AmazonOrderId'] = (string)$d->AmazonOrderId;
        if (isset($d->SellerOrderId)) {
            $this->data['SellerOrderId'] = (string)$d->SellerOrderId;
        }
        $this->data['Status'] = (string)$d->Status;
        if (isset($d->TrackingId)) {
            $this->data['TrackingId'] = (string)$d->TrackingId;
        }
        $this->data['CreatedDate'] = (string)$d->CreatedDate;
        if (isset($d->LastUpdatedDate)) {
            $this->data['LastUpdatedDate'] = (string)$d->LastUpdatedDate;
        }
        $this->data['Weight']['Value'] = (string)$d->Weight->Value;
        $this->data['Weight']['Unit'] = (string)$d->Weight->Unit;
        $this->data['Insurance']['Amount'] = (string)$d->Insurance->Amount;
        $this->data['Insurance']['CurrencyCode'] = (string)$d->Insurance->CurrencyCode;
        if (isset($d->Label)) {
            $this->data['Label']['Dimensions']['Length'] = (string)$d->Label->Dimensions->Length;
            $this->data['Label']['Dimensions']['Width'] = (string)$d->Label->Dimensions->Width;
            $this->data['Label']['Dimensions']['Unit'] = (string)$d->Label->Dimensions->Unit;
            $this->data['Label']['FileContents']['Contents'] = (string)$d->Label->FileContents->Contents;
            $this->data['Label']['FileContents']['FileType'] = (string)$d->Label->FileContents->FileType;
            $this->data['Label']['FileContents']['Checksum'] = (string)$d->Label->FileContents->Checksum;
            if (isset($d->Label->CustomTextForLabel)) {
                $this->data['Label']['CustomTextForLabel'] = (string)$d->Label->CustomTextForLabel;
            }
            if (isset($d->Label->LabelFormat)) {
                $this->data['Label']['LabelFormat'] = (string)$d->Label->LabelFormat;
            }
            if (isset($d->Label->StandardIdForLabel)) {
                $this->data['Label']['StandardIdForLabel'] = (string)$d->Label->StandardIdForLabel;
            }
        }

        $this->data['ItemList'] = array();
        foreach ($d->ItemList->children() as $x) {
            $temp = array();
            $temp['OrderItemId'] = (string)$x->OrderItemId;
            $temp['Quantity'] = (string)$x->Quantity;
            $this->data['ItemList'][] = $temp;
        }
        if (isset($d->PackageDimensions->Length)) {
            $this->data['PackageDimensions']['Length'] = (string)$d->PackageDimensions->Length;
            $this->data['PackageDimensions']['Width'] = (string)$d->PackageDimensions->Width;
            $this->data['PackageDimensions']['Height'] = (string)$d->PackageDimensions->Height;
            $this->data['PackageDimensions']['Unit'] = (string)$d->PackageDimensions->Unit;
        }
        if (isset($d->PackageDimensions->PredefinedPackageDimensions)) {
            $this->data['PackageDimensions']['PredefinedPackageDimensions'] = (string)$d->PackageDimensions->PredefinedPackageDimensions;
        }

        //Ship From Address
        $this->data['ShipFromAddress']['Name'] = (string)$d->ShipFromAddress->Name;
        $this->data['ShipFromAddress']['AddressLine1'] = (string)$d->ShipFromAddress->AddressLine1;
        if (isset($d->ShipFromAddress->AddressLine3)) {
            $this->data['ShipFromAddress']['AddressLine2'] = (string)$d->ShipFromAddress->AddressLine2;
        }
        if (isset($d->ShipFromAddress->AddressLine3)) {
            $this->data['ShipFromAddress']['AddressLine2'] = (string)$d->ShipFromAddress->AddressLine3;
        }
        if (isset($d->ShipFromAddress->DistrictOrCounty)) {
            $this->data['ShipFromAddress']['DistrictOrCounty'] = (string)$d->ShipFromAddress->DistrictOrCounty;
        }
        $this->data['ShipFromAddress']['Email'] = (string)$d->ShipFromAddress->Email;
        $this->data['ShipFromAddress']['City'] = (string)$d->ShipFromAddress->City;
        if (isset($d->ShipFromAddress->StateOrProvinceCode)) {
            $this->data['ShipFromAddress']['StateOrProvinceCode'] = (string)$d->ShipFromAddress->StateOrProvinceCode;
        }
        $this->data['ShipFromAddress']['PostalCode'] = (string)$d->ShipFromAddress->PostalCode;
        $this->data['ShipFromAddress']['CountryCode'] = (string)$d->ShipFromAddress->CountryCode;
        $this->data['ShipFromAddress']['Phone'] = (string)$d->ShipFromAddress->Phone;

        //Ship To Address
        $this->data['ShipToAddress']['Name'] = (string)$d->ShipToAddress->Name;
        $this->data['ShipToAddress']['AddressLine1'] = (string)$d->ShipToAddress->AddressLine1;
        if (isset($d->ShipToAddress->AddressLine3)) {
            $this->data['ShipToAddress']['AddressLine2'] = (string)$d->ShipToAddress->AddressLine2;
        }
        if (isset($d->ShipToAddress->AddressLine3)) {
            $this->data['ShipToAddress']['AddressLine2'] = (string)$d->ShipToAddress->AddressLine3;
        }
        if (isset($d->ShipToAddress->DistrictOrCounty)) {
            $this->data['ShipToAddress']['DistrictOrCounty'] = (string)$d->ShipToAddress->DistrictOrCounty;
        }
        $this->data['ShipToAddress']['Email'] = (string)$d->ShipToAddress->Email;
        $this->data['ShipToAddress']['City'] = (string)$d->ShipToAddress->City;
        if (isset($d->ShipToAddress->StateOrProvinceCode)) {
            $this->data['ShipToAddress']['StateOrProvinceCode'] = (string)$d->ShipToAddress->StateOrProvinceCode;
        }
        $this->data['ShipToAddress']['PostalCode'] = (string)$d->ShipToAddress->PostalCode;
        $this->data['ShipToAddress']['CountryCode'] = (string)$d->ShipToAddress->CountryCode;
        $this->data['ShipToAddress']['Phone'] = (string)$d->ShipToAddress->Phone;

        //Service
        $this->data['ShippingService']['ShippingServiceName'] = (string)$d->ShippingService->ShippingServiceName;
        $this->data['ShippingService']['CarrierName'] = (string)$d->ShippingService->CarrierName;
        $this->data['ShippingService']['ShippingServiceId'] = (string)$d->ShippingService->ShippingServiceId;
        $this->data['ShippingService']['ShippingServiceOfferId'] = (string)$d->ShippingService->ShippingServiceOfferId;
        $this->data['ShippingService']['ShipDate'] = (string)$d->ShippingService->ShipDate;
        if (isset($d->ShippingService->EarliestEstimatedDeliveryDate)) {
            $this->data['ShippingService']['EarliestEstimatedDeliveryDate'] = (string)$d->ShippingService->EarliestEstimatedDeliveryDate;
        }
        if (isset($d->ShippingService->LatestEstimatedDeliveryDate)) {
            $this->data['ShippingService']['LatestEstimatedDeliveryDate'] = (string)$d->ShippingService->LatestEstimatedDeliveryDate;
        }
        $this->data['ShippingService']['Rate']['Amount'] = (string)$d->ShippingService->Rate->Amount;
        $this->data['ShippingService']['Rate']['CurrencyCode'] = (string)$d->ShippingService->Rate->CurrencyCode;
        $this->data['ShippingService']['DeliveryExperience'] = (string)$d->ShippingService->ShippingServiceOptions->DeliveryExperience;
        $this->data['ShippingService']['CarrierWillPickUp'] = (string)$d->ShippingService->ShippingServiceOptions->CarrierWillPickUp;
        if (isset($d->ShippingService->ShippingServiceOptions->DeclaredValue)) {
            $this->data['ShippingService']['DeclaredValue']['Amount'] = (string)$d->ShippingService->ShippingServiceOptions->DeclaredValue->Amount;
            $this->data['ShippingService']['DeclaredValue']['CurrencyCode'] = (string)$d->ShippingService->ShippingServiceOptions->DeclaredValue->CurrencyCode;
        }
    }
1285708
protected function xmlSerialize($data, $xml = null)
    {
        if ( !$xml instanceof SimpleXMLElement )
        {
            $xml = new SimpleXMLElement('<'. $this->requestName .' xmlns="'. $this->namespace .'" />');
        }

        foreach ($data as $key => $value)
        {
            if ( !isset($value) )
            {
                continue;
            }

            if ( is_array($value) )
            {
                $node = $xml->addChild($key);
                $this->xmlSerialize($value, $node);
            }
            else
            {
                $xml->addChild($key, $value);
            }
        }

        return $xml->asXML();
    }
987269
protected function parseFee($xml) {
        $r = array();
        $r['FeeType'] = (string)$xml->FeeType;
        $r['Amount'] = (string)$xml->FeeAmount->CurrencyAmount;
        $r['CurrencyCode'] = (string)$xml->FeeAmount->CurrencyCode;
        return $r;
    }
467005
protected function convertXmlToArray($xml)
    {
        // Convert the response to an array via a 3-way conversion:
        // - create a simplexml object
        // - convert that to json
        // - convert json to array
        libxml_use_internal_errors(true);
        if (!($result = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA))) {
            $this->raiseLibxmlError(libxml_get_errors());
        }

        if (!($result = json_encode($result))) {
            $this->raiseJsonError();
        }
        if (($result = json_decode($result, true)) === null) {
            $this->raiseJsonError();
        }

        return $result;
    }
1273253
public function fromXml(string $xml): array
    {
        if (!$this->isEmptyValue($xml)) {

            libxml_use_internal_errors(true);

            // convert string to xml object
            $result = simplexml_load_string("$xml", 'SimpleXMLElement', LIBXML_NOCDATA);

            if ($result) {
                return $this->fromClass($result);

            } else {

                foreach (libxml_get_errors() as $error) {

                    // if don`t have container add that`s
                    if ($error->code == 5) {
                        $this->errors = [];

                        // append container and parse again
                        return $this->fromXml("<DATA>$xml</DATA>");

                    } else
                        $this->setError($error->code, $error->message);
                }
            }
        }

        return $this->result;
    }
1030442
protected function parseXML($xml){
        if (!$xml){
            return false;
        }
        foreach($xml->ShipmentData->children() as $x){
            $a = array();

            if (isset($x->ShipmentId)){
                $a['ShipmentId'] = (string)$x->ShipmentId;
            }
            if (isset($x->ShipmentName)){
                $a['ShipmentName'] = (string)$x->ShipmentName;
            }

            //Address
            $a['ShipFromAddress']['Name'] = (string)$x->ShipFromAddress->Name;
            $a['ShipFromAddress']['AddressLine1'] = (string)$x->ShipFromAddress->AddressLine1;
            if (isset($x->ShipFromAddress->AddressLine2)){
                $a['ShipFromAddress']['AddressLine2'] = (string)$x->ShipFromAddress->AddressLine2;
            } else {
                $a['ShipFromAddress']['AddressLine2'] = null;
            }
            $a['ShipFromAddress']['City'] = (string)$x->ShipFromAddress->City;
            if (isset($x->ShipFromAddress->DistrictOrCounty)){
                $a['ShipFromAddress']['DistrictOrCounty'] = (string)$x->ShipFromAddress->DistrictOrCounty;
            } else {
                $a['ShipFromAddress']['DistrictOrCounty'] = null;
            }
            $a['ShipFromAddress']['StateOrProvinceCode'] = (string)$x->ShipFromAddress->StateOrProvinceCode;
            $a['ShipFromAddress']['CountryCode'] = (string)$x->ShipFromAddress->CountryCode;
            $a['ShipFromAddress']['PostalCode'] = (string)$x->ShipFromAddress->PostalCode;

            if (isset($x->DestinationFulfillmentCenterId)){
                $a['DestinationFulfillmentCenterId'] = (string)$x->DestinationFulfillmentCenterId;
            }
            if (isset($x->LabelPrepType)){
                $a['LabelPrepType'] = (string)$x->LabelPrepType;
            }
            if (isset($x->ShipmentStatus)){
                $a['ShipmentStatus'] = (string)$x->ShipmentStatus;
            }

            $a['AreCasesRequired'] = (string)$x->AreCasesRequired;

            if (isset($x->ConfirmedNeedByDate)){
                $a['ConfirmedNeedByDate'] = (string)$x->ConfirmedNeedByDate;
            }
            
            $this->shipmentList[$this->index] = $a;
            $this->index++;
        }
    }
511604
protected function parseXML($xml){
        $this->list = array();
        if (!$xml){
            return false;
        }

        foreach ($xml->SubscriptionList->children() as $x) {
            $temp = array();
            $temp['NotificationType'] = (string)$x->NotificationType;
            $temp['IsEnabled'] = (string)$x->IsEnabled;
            $temp['Destination']['DeliveryChannel'] = (string)$x->Destination->DeliveryChannel;
            foreach ($x->Destination->AttributeList->children() as $z) {
                $temp['Destination']['AttributeList'][(string)$z->Key] = (string)$z->Value;
            }
            $this->list[] = $temp;
        }
    }
623854
protected function parseXML($xml){
        if (!$xml){
            return false;
        }
        $this->lastTimestamp = (string)$xml->Timestamp;
        $this->status = (string)$xml->Status;
        
        if ($this->status == 'GREEN_I'){
            $this->messageId = (string)$xml->MessageId;
            $i = 0;
            foreach ($xml->Messages->children() as $x){
                $this->messageList[$i] = (string)$x->Text;
                $i++;
            }
        }
    }
849416
protected function parseParameters(SimpleXMLElement $xml)
    {
        if (!$xml->parameters) {
            return;
        }

        $this->container->getParameterBag()->add($this->getArgumentsAsPhp($xml->parameters, 'parameter'));
    }
379083
public function convertXml($xml)
    {
        try {
            $xml = Xml::build($xml, ['return' => 'domdocument', 'readFile' => false]);
            // We might not get child nodes if there are nested inline entities.
            if ((int)$xml->childNodes->length > 0) {
                return Xml::toArray($xml);
            }

            return [];
        } catch (XmlException $e) {
            return [];
        }
    }