Hitachi Vantara Pentaho Community Forums
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Mutiple Loop XPath in Get Data from XML

  1. #1
    Join Date
    Oct 2008
    Posts
    4

    Smile Mutiple Loop XPath in Get Data from XML

    Can it be possible to define multiple Loop XPath in Get data from XML file?
    If not, then how I can process a xml file where i have more than one repeating tags for eg:

    - <CHARGES_DETAILS>
    - <OC CREDIT_DEBIT_IND="DBT" VALUE="0.01">
    <OC_DETAILS TOTAL="0.00" LOCATION_ADDRESS="" EFFECTIVE_DATE="" PRODUCT_DESCRIPTION="ANI Delivery Charges-ANI Delivery Charges" PRORATION_FACTOR="0.00" LOCATION_ID="" CHARGE_GROUP="PRO RATED CHARGE" TAXES_FEES_SURCHARGES="0.00" PREDISCOUNTED_CHARGE="0.00" />

    <OC_DETAILS TOTAL="0.01" LOCATION_ADDRESS="" EFFECTIVE_DATE="" PRODUCT_DESCRIPTION="ANI Delivery Charges-ANI Delivery Charges" PRORATION_FACTOR="0.00" LOCATION_ID="" CHARGE_GROUP="ONE TIME CHARGE" TAXES_FEES_SURCHARGES="0.00" PREDISCOUNTED_CHARGE="0.01" />

    </OC>


    - <RC CREDIT_DEBIT_IND="DBT" VALUE="0.00">
    <RC_DETAILS TAX="0.00" CHARGE_DESCRIPTION="17CVP ADMIN-VOLUME PRICING PLA" TOTAL="0.00" PREDISCOUNTED_CHARGE="0.00" LOCATION_ID="" PRODUCT_DESCRIPTION="17CVP ADMIN-VOLUME PRICING PLA" LOCATION_ADDRESS="" />

    <RC_DETAILS TAX="0.00" CHARGE_DESCRIPTION="17CVP ADMIN-VOLUME PRICING PLA" TOTAL="0.00" PREDISCOUNTED_CHARGE="0.00" LOCATION_ID="" PRODUCT_DESCRIPTION="17CVP ADMIN-VOLUME PRICING PLA" LOCATION_ADDRESS="" />

    <RC_DETAILS TAX="0.00" CHARGE_DESCRIPTION="17CVP ADMIN-VOLUME PRICING PLA" TOTAL="0.00" PREDISCOUNTED_CHARGE="0.00" LOCATION_ID="" PRODUCT_DESCRIPTION="17CVP ADMIN-VOLUME PRICING PLA" LOCATION_ADDRESS="" />

    </RC>

    </CHARGES_DETAILS>


    In above xml file I have two repeating tags for charges OC_Details and RC_Details. like this i can have more also.


    thanks in advance.....

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    Process the file twice. The Xpath loop determines where the engine halts and makes a new row.

    Even if you would be able to get Xpath stop on both elements you want, your "surrounding" XML fragment doesn't have the same structure so you would be stuck there anyway.

    Regards,
    Sven

  3. #3
    Join Date
    Oct 2008
    Posts
    4

    Default

    thanks for reply.....
    for 2 different tags if I need to process the file twice, in my case I have 25 repeating tags in my XML file.

    What can be the optimized process for this?

    Also, if you can give a short example for this to process, it will be much earsier to understand then.

    thanks again....

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    Nothing can be optimized about it. Your XML is too different in different places.

    Think of the Xpath loop as the place where PDI will halt and create a row... you can retrieve the fields for your row based relatively on your stop place. Since the XML around your different tags are also different you wouldn't be able to set all fields of your row (if you would find a way for XPath to stop at multiple places).

    You want to process multiple different tags ... process the file multiple times.

    Regards,
    Sven
    Last edited by sboden; 04-09-2009 at 01:19 PM.

  5. #5
    Join Date
    Apr 2009
    Posts
    9

    Default

    hi, I wanted to understand how I could make to turn my trial more times the trial it is the following:<GBORDO n.isole="1" n.vert="12">
    <VERTISOLA>5 </VERTISOLA>
    <COORD>11306.520,-11240.056 11298.205,-11230.088 11274.640,-11205.407 11273.945,-11668.160 11302.013,-11664.819 11303.418,-11416.754 11306.520,-11240.056 11288.433,-11290.674 11279.000,-11290.645 11278.970,-11300.341 11288.022,-11299.810 11288.433,-11290.674 12124.660,-11183.826 12123.994,-11154.190 12114.488,-11154.532 12121.039,-11339.435 12124.359,-11339.688 12124.424,-11306.196 12124.660,-11183.826</COORD>
    </GBORDO>
    </BORDO>
    thanks

  6. #6
    Join Date
    Apr 2009
    Posts
    9

    Default Problem with multiple loop on file xml

    HEllo,I have a problem with a file xml.I wouls ask you a thing about a piece of code:


    <BORDO valenza="CONSOLID" esterconf="NO" codbo="5127" dim="18" ang="0.000" posx="11279.451" posy="-11449.037" pintx="11279.451" pinty="-11449.037">
    <GBORDO n.isole="2" n.vert="17">
    <VERTISOLA>5</VERTISOLA>
    <VERTISOLA>7</VERTISOLA>
    <COORD>11306.520,-11240.056 11298.205,-11230.088 11274.640,-11205.407 11273.945,-11668.160 11302.013,-11664.819 11303.418,-11416.754 11306.520,-11240.056 11288.433,-11290.674 11279.000,-11290.645 11278.970,-11300.341 11288.022,-11299.810 11288.433,-11290.674</COORD>
    <COORD>11306.520,-11240.056 11298.205,-11230.088 11274.640,-11205.407 11273.945,-11668.160 11302.013,-11664.819 11303.418,-11416.754 11306.520,-11240.056 12124.660,-11183.826 12123.994,-11154.190 12114.488,-11154.532 12121.039,-11339.435 12124.359,-11339.688 12124.424,-11306.196 12124.660,-11183.826</COORD>
    </GBORDO>
    </BORDO>


    I ought to do some cycles some multiple loop both on BORDO and VERTISOLA (when I have more VERTISOLA in the BORD) When the program starts,it loop me on all BORD,but,it works,if some BORD has just one VERTISOLA; but if it has more than one it doesen't works,that means it doesen't loop on VERTISOLA.I would know how to solve this problem!Thank you See you soon.Have a nice day.

  7. #7
    Join Date
    Apr 2009
    Posts
    9

    Default Problem with multiple loop xPath on get data from xml

    HEllo,I have a problem with a file xml.I wouls ask you a thing about a piece of code:


    <BORDO valenza="CONSOLID" esterconf="NO" codbo="5127" dim="18" ang="0.000" posx="11279.451" posy="-11449.037" pintx="11279.451" pinty="-11449.037">
    <GBORDO n.isole="2" n.vert="17">
    <VERTISOLA>5</VERTISOLA>
    <VERTISOLA>7</VERTISOLA>
    <COORD>11306.520,-11240.056 11298.205,-11230.088 11274.640,-11205.407 11273.945,-11668.160 11302.013,-11664.819 11303.418,-11416.754 11306.520,-11240.056 11288.433,-11290.674 11279.000,-11290.645 11278.970,-11300.341 11288.022,-11299.810 11288.433,-11290.674</COORD>
    <COORD>11306.520,-11240.056 11298.205,-11230.088 11274.640,-11205.407 11273.945,-11668.160 11302.013,-11664.819 11303.418,-11416.754 11306.520,-11240.056 12124.660,-11183.826 12123.994,-11154.190 12114.488,-11154.532 12121.039,-11339.435 12124.359,-11339.688 12124.424,-11306.196 12124.660,-11183.826</COORD>
    </GBORDO>
    </BORDO>


    I ought to do some cycles some multiple loop both on BORDO and VERTISOLA (when I have more VERTISOLA in the BORD) When the program starts,it loop me on all BORD,but,it works,if some BORD has just one VERTISOLA; but if it has more than one it doesen't works,that means it doesen't loop on VERTISOLA.I would know how to solve this problem!Thank you See you soon.Have a nice day.

  8. #8

    Default

    Hi,

    if you want to extract all VERTISOLA (5 & 7 in you example), just specify

    /BORDO/GBORDO/VERTISOLA

    as xpath loop and put "." as Xpath field.


    Samata
    Samatar

  9. #9
    Join Date
    Apr 2009
    Posts
    9

    Default Problem with multiple loop xPath in the get data from xml

    thanks,but how cani do this with the programm Spoon of Geokettle?

  10. #10
    Join Date
    Apr 2009
    Posts
    9

    Default Problem with multiple loop xPath in the get data from xml

    Quote Originally Posted by shassan2 View Post
    Hi,

    if you want to extract all VERTISOLA (5 & 7 in you example), just specify

    /BORDO/GBORDO/VERTISOLA

    as xpath loop and put "." as Xpath field.


    Samata

    but in xpath loop don't see this path:

    /BORDO/GBORDO/VERTISOLA

    but only this:

    /BORDO

    then i wanted to know if there was somthing wrong with xml file.
    thanks for the reply

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.