[ create a new paste ] login | about

Link: http://codepad.org/1fNDWDba    [ raw code | output | fork ]

PHP, pasted on Sep 17:
<?php
$reader = new XMLReader();
$reader->XML('<?xml version="1.0"?>
<GetMatchingProductResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">
  <GetMatchingProductResult ASIN="B06Y16RL4W" status="Success">
    <Product>
      <Identifiers>
        <MarketplaceASIN>
          <MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
          <ASIN>B06Y16RL4W</ASIN>
        </MarketplaceASIN>
      </Identifiers>
      <AttributeSets>
        <ns2:ItemAttributes xmlns:ns2="http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd" xml:lang="en-US">
          <ns2:Binding>Unlocked Phone</ns2:Binding>
          <ns2:Brand>Samsung</ns2:Brand>
          <ns2:Color>Black</ns2:Color>
          <ns2:Department>Wireless</ns2:Department>
          <ns2:DisplaySize Units="inches">6.2</ns2:DisplaySize>
          <ns2:ItemDimensions>
            <ns2:Height Units="inches">0.32</ns2:Height>
            <ns2:Length Units="inches">6.28</ns2:Length>
            <ns2:Width Units="inches">2.89</ns2:Width>
            <ns2:Weight Units="pounds">0.381</ns2:Weight>
          </ns2:ItemDimensions>
          <ns2:IsEligibleForTradeIn>true</ns2:IsEligibleForTradeIn>
          <ns2:Label>Samsung</ns2:Label>
          <ns2:ListPrice>
            <ns2:Amount>689.99</ns2:Amount>
            <ns2:CurrencyCode>USD</ns2:CurrencyCode>
          </ns2:ListPrice>
          <ns2:Manufacturer>Samsung</ns2:Manufacturer>
          <ns2:Model>SM-G955UZKAXAA</ns2:Model>
          <ns2:NumberOfItems>1</ns2:NumberOfItems>
          <ns2:OperatingSystem>android;android 7</ns2:OperatingSystem>
          <ns2:PackageDimensions>
            <ns2:Height Units="inches">2.199999997756</ns2:Height>
            <ns2:Length Units="inches">6.799999993064</ns2:Length>
            <ns2:Width Units="inches">3.699999996226</ns2:Width>
            <ns2:Weight Units="pounds">1.10010668738</ns2:Weight>
          </ns2:PackageDimensions>
          <ns2:PackageQuantity>1</ns2:PackageQuantity>
          <ns2:PartNumber>SM-G955UZKAXAA</ns2:PartNumber>
          <ns2:ProcessorCount>4</ns2:ProcessorCount>
          <ns2:ProductGroup>Wireless</ns2:ProductGroup>
          <ns2:ProductTypeName>WIRELESS_DEVICE</ns2:ProductTypeName>
          <ns2:Publisher>Samsung</ns2:Publisher>
          <ns2:Size>Galaxy S8+</ns2:Size>
          <ns2:SmallImage>
            <ns2:URL>http://ecx.images-amazon.com/images/I/417dUvGor3L._SL75_.jpg</ns2:URL>
            <ns2:Height Units="pixels">75</ns2:Height>
            <ns2:Width Units="pixels">75</ns2:Width>
          </ns2:SmallImage>
          <ns2:Studio>Samsung</ns2:Studio>
          <ns2:Title>Samsung Galaxy S8+ Unlocked 64GB - US Version (Midnight Black) - US Warranty</ns2:Title>
        </ns2:ItemAttributes>
      </AttributeSets>
      <Relationships>
        <VariationParent xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">
          <Identifiers>
            <MarketplaceASIN>
              <MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
              <ASIN>B072R1N7CF</ASIN>
            </MarketplaceASIN>
          </Identifiers>
        </VariationParent>
      </Relationships>
      <SalesRankings>
        <SalesRank>
          <ProductCategoryId>wireless_display_on_website</ProductCategoryId>
          <Rank>4179</Rank>
        </SalesRank>
        <SalesRank>
          <ProductCategoryId>2407749011</ProductCategoryId>
          <Rank>62</Rank>
        </SalesRank>
      </SalesRankings>
    </Product>
  </GetMatchingProductResult>
  <GetMatchingProductResult ASIN="B071DQ128D" status="Success">
    <Product>
      <Identifiers>
        <MarketplaceASIN>
          <MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
          <ASIN>B071DQ128D</ASIN>
        </MarketplaceASIN>
      </Identifiers>
      <AttributeSets>
        <ns2:ItemAttributes xmlns:ns2="http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd" xml:lang="en-US">
          <ns2:Binding>Wireless Phone Accessory</ns2:Binding>
          <ns2:Brand>Samsung</ns2:Brand>
          <ns2:Color>Maple Gold</ns2:Color>
          <ns2:Department>Unlocked Phones</ns2:Department>
          <ns2:DisplaySize Units="inches">6.2</ns2:DisplaySize>
          <ns2:ItemDimensions>
            <ns2:Height Units="inches">0.32</ns2:Height>
            <ns2:Length Units="inches">6.28</ns2:Length>
            <ns2:Width Units="inches">2.89</ns2:Width>
            <ns2:Weight Units="pounds">0.38139971326</ns2:Weight>
          </ns2:ItemDimensions>
          <ns2:IsEligibleForTradeIn>true</ns2:IsEligibleForTradeIn>
          <ns2:Label>Samsung</ns2:Label>
          <ns2:Manufacturer>Samsung</ns2:Manufacturer>
          <ns2:Model>G955FD</ns2:Model>
          <ns2:NumberOfItems>1</ns2:NumberOfItems>
          <ns2:PackageDimensions>
            <ns2:Height Units="inches">2.0866141711</ns2:Height>
            <ns2:Length Units="inches">6.8503936938</ns2:Length>
            <ns2:Width Units="inches">3.7401574765</ns2:Width>
            <ns2:Weight Units="pounds">1.12215291358</ns2:Weight>
          </ns2:PackageDimensions>
          <ns2:PackageQuantity>1</ns2:PackageQuantity>
          <ns2:PartNumber>SM-G955FD</ns2:PartNumber>
          <ns2:ProductGroup>Wireless</ns2:ProductGroup>
          <ns2:ProductTypeName>WIRELESS_DEVICE</ns2:ProductTypeName>
          <ns2:Publisher>Samsung</ns2:Publisher>
          <ns2:SmallImage>
            <ns2:URL>http://ecx.images-amazon.com/images/I/41IgpIMzJ9L._SL75_.jpg</ns2:URL>
            <ns2:Height Units="pixels">75</ns2:Height>
            <ns2:Width Units="pixels">75</ns2:Width>
          </ns2:SmallImage>
          <ns2:Studio>Samsung</ns2:Studio>
          <ns2:Title>Samsung Galaxy S8 Plus (S8+) (SM-G955FD) 4GB RAM / 64GB ROM 6.2-Inch 12MP 4G LTE Dual SIM FACTORY UNLOCKED - International Stock No Warranty (MAPLE GOLD)</ns2:Title>
        </ns2:ItemAttributes>
      </AttributeSets>
      <Relationships>
        <VariationParent xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">
          <Identifiers>
            <MarketplaceASIN>
              <MarketplaceId>ATVPDKIKX0DER</MarketplaceId>
              <ASIN>B0722LC48Q</ASIN>
            </MarketplaceASIN>
          </Identifiers>
        </VariationParent>
      </Relationships>
      <SalesRankings>
        <SalesRank>
          <ProductCategoryId>wireless_display_on_website</ProductCategoryId>
          <Rank>18567</Rank>
        </SalesRank>
        <SalesRank>
          <ProductCategoryId>2407749011</ProductCategoryId>
          <Rank>347</Rank>
        </SalesRank>
      </SalesRankings>
    </Product>
  </GetMatchingProductResult>
  <ResponseMetadata>
    <RequestId>bd069a88-bde9-4c55-9734-582c7253a7c1</RequestId>
  </ResponseMetadata>
</GetMatchingProductResponse>
');

while($reader->read())
{
        if($reader->nodeType == XMLREADER::ELEMENT)
        {
                $name = (string)$reader->name;
                $reader->read();
                $valu = (string)$reader->value;
                echo $name .' --> '.$valu . "\n";
        }
}


Output:
GetMatchingProductResponse --> 
  
GetMatchingProductResult --> 
    
Product --> 
      
Identifiers --> 
        
MarketplaceASIN --> 
          
MarketplaceId --> ATVPDKIKX0DER
ASIN --> B06Y16RL4W
AttributeSets --> 
        
ns2:ItemAttributes --> 
          
ns2:Binding --> Unlocked Phone
ns2:Brand --> Samsung
ns2:Color --> Black
ns2:Department --> Wireless
ns2:DisplaySize --> 6.2
ns2:ItemDimensions --> 
            
ns2:Height --> 0.32
ns2:Length --> 6.28
ns2:Width --> 2.89
ns2:Weight --> 0.381
ns2:IsEligibleForTradeIn --> true
ns2:Label --> Samsung
ns2:ListPrice --> 
            
ns2:Amount --> 689.99
ns2:CurrencyCode --> USD
ns2:Manufacturer --> Samsung
ns2:Model --> SM-G955UZKAXAA
ns2:NumberOfItems --> 1
ns2:OperatingSystem --> android;android 7
ns2:PackageDimensions --> 
            
ns2:Height --> 2.199999997756
ns2:Length --> 6.799999993064
ns2:Width --> 3.699999996226
ns2:Weight --> 1.10010668738
ns2:PackageQuantity --> 1
ns2:PartNumber --> SM-G955UZKAXAA
ns2:ProcessorCount --> 4
ns2:ProductGroup --> Wireless
ns2:ProductTypeName --> WIRELESS_DEVICE
ns2:Publisher --> Samsung
ns2:Size --> Galaxy S8+
ns2:SmallImage --> 
            
ns2:URL --> http://ecx.images-amazon.com/images/I/417dUvGor3L._SL75_.jpg
ns2:Height --> 75
ns2:Width --> 75
ns2:Studio --> Samsung
ns2:Title --> Samsung Galaxy S8+ Unlocked 64GB - US Version (Midnight Black) - US Warranty
Relationships --> 
        
VariationParent --> 
          
Identifiers --> 
            
MarketplaceASIN --> 
              
MarketplaceId --> ATVPDKIKX0DER
ASIN --> B072R1N7CF
SalesRankings --> 
        
SalesRank --> 
          
ProductCategoryId --> wireless_display_on_website
Rank --> 4179
SalesRank --> 
          
ProductCategoryId --> 2407749011
Rank --> 62
GetMatchingProductResult --> 
    
Product --> 
      
Identifiers --> 
        
MarketplaceASIN --> 
          
MarketplaceId --> ATVPDKIKX0DER
ASIN --> B071DQ128D
AttributeSets --> 
        
ns2:ItemAttributes --> 
          
ns2:Binding --> Wireless Phone Accessory
ns2:Brand --> Samsung
ns2:Color --> Maple Gold
ns2:Department --> Unlocked Phones
ns2:DisplaySize --> 6.2
ns2:ItemDimensions --> 
            
ns2:Height --> 0.32
ns2:Length --> 6.28
ns2:Width --> 2.89
ns2:Weight --> 0.38139971326
ns2:IsEligibleForTradeIn --> true
ns2:Label --> Samsung
ns2:Manufacturer --> Samsung
ns2:Model --> G955FD
ns2:NumberOfItems --> 1
ns2:PackageDimensions --> 
            
ns2:Height --> 2.0866141711
ns2:Length --> 6.8503936938
ns2:Width --> 3.7401574765
ns2:Weight --> 1.12215291358
ns2:PackageQuantity --> 1
ns2:PartNumber --> SM-G955FD
ns2:ProductGroup --> Wireless
ns2:ProductTypeName --> WIRELESS_DEVICE
ns2:Publisher --> Samsung
ns2:SmallImage --> 
            
ns2:URL --> http://ecx.images-amazon.com/images/I/41IgpIMzJ9L._SL75_.jpg
ns2:Height --> 75
ns2:Width --> 75
ns2:Studio --> Samsung
ns2:Title --> Samsung Galaxy S8 Plus (S8+) (SM-G955FD) 4GB RAM / 64GB ROM 6.2-Inch 12MP 4G LTE Dual SIM FACTORY UNLOCKED - International Stock No Warranty (MAPLE GOLD)
Relationships --> 
        
VariationParent --> 
          
Identifiers --> 
            
MarketplaceASIN --> 
              
MarketplaceId --> ATVPDKIKX0DER
ASIN --> B0722LC48Q
SalesRankings --> 
        
SalesRank --> 
          
ProductCategoryId --> wireless_display_on_website
Rank --> 18567
SalesRank --> 
          
ProductCategoryId --> 2407749011
Rank --> 347
ResponseMetadata --> 
    
RequestId --> bd069a88-bde9-4c55-9734-582c7253a7c1


Create a new paste based on this one


Comments: