Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Parsing XML with repeating <key><value> elements

  1. #1

    Default Parsing XML with repeating <key><value> elements

    Hi all,

    I have a problem to parse a XML content I got from WebServices lookup step (Magento result). The content is as follows
    <SOAP-ENV:Body>
    <ns1:callResponse>
    <callReturn SOAP-ENC:arrayType="ns2:Map[78]" xsi:type="SOAP-ENC:Array">
    <item xsi:type="ns2:Map">
    <item>
    <key xsi:type="xsd:string">product_id</key>
    <value xsi:type="xsd:string">9088</value>
    </item>
    <item>
    <key xsi:type="xsd:string">sku</key>
    <value xsi:type="xsd:string">15861</value>
    </item>
    <item>
    <key xsi:type="xsd:string">name</key>
    <value xsi:type="xsd:string">part1</value>
    </item>
    <item>
    <key xsi:type="xsd:string">set</key>
    <value xsi:type="xsd:string">4</value>
    </item>
    <item>
    <key xsi:type="xsd:string">type</key>
    <value xsi:type="xsd:string">simple</value>
    </item>
    <item>
    <key xsi:type="xsd:string">category_ids</key>
    <value SOAP-ENC:arrayType="xsd:ur-type[0]" xsi:type="SOAP-ENC:Array"/>
    </item>
    <item>
    <key xsi:type="xsd:string">website_ids</key>
    <value SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array">
    <item xsi:type="xsd:string">1</item>
    </value>
    </item>
    </item>
    <item xsi:type="ns2:Map">
    <item>
    <key xsi:type="xsd:string">product_id</key>
    <value xsi:type="xsd:string">9109</value>
    </item>
    <item>
    <key xsi:type="xsd:string">sku</key>
    <value xsi:type="xsd:string">15882</value>
    </item>
    <item>
    <key xsi:type="xsd:string">name</key>
    <value xsi:type="xsd:string">part2</value>
    </item>
    <item>
    <key xsi:type="xsd:string">set</key>
    <value xsi:type="xsd:string">4</value>
    </item>
    <item>
    <key xsi:type="xsd:string">type</key>
    <value xsi:type="xsd:string">simple</value>
    </item>
    <item>
    <key xsi:type="xsd:string">category_ids</key>
    <value SOAP-ENC:arrayType="xsd:ur-type[0]" xsi:type="SOAP-ENC:Array"/>
    </item>
    <item>
    <key xsi:type="xsd:string">website_ids</key>
    <value SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array">
    <item xsi:type="xsd:string">1</item>
    </value>
    </item>
    </item>
    ......
    Is there a way to simply get data in following colums?
    product_id, SKU, name, set

    Any help will be appreciated. Thank you very much
    Magdalena

  2. #2

    Default

    It looks like you'd need to parse the data out of the XML content using Get Data from XML, and then use the Row Denormalizer step in order to get 1 row per item, with fields for each attribute (SKU, product_id, etc.).

    I believe that there are sample transformations included in the PDI application (look in the data-integration/samples directory), which may help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.