View Full Version : Mutiple Loop XPath in Get Data from XML
gurdeep
04-09-2009, 09:36 AM
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:
- (file:///I:/ATT%20Business%20Direct/Media%20General/testDataPentaho/10007917023_ONENET_03012009_2144940237_8241385.xml#) <CHARGES_DETAILS>
- (file:///I:/ATT%20Business%20Direct/Media%20General/testDataPentaho/10007917023_ONENET_03012009_2144940237_8241385.xml#) <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>
- (file:///I:/ATT%20Business%20Direct/Media%20General/testDataPentaho/10007917023_ONENET_03012009_2144940237_8241385.xml#) <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.....
sboden
04-09-2009, 09:44 AM
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
gurdeep
04-09-2009, 10:08 AM
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....
sboden
04-09-2009, 01:13 PM
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
Ixion86
04-22-2009, 11:23 AM
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
Ixion86
04-26-2009, 06:14 AM
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.
Ixion86
04-26-2009, 06:15 AM
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.
shassan2
04-26-2009, 11:23 AM
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
Ixion86
04-27-2009, 04:12 AM
thanks,but how cani do this with the programm Spoon of Geokettle?:confused:
Ixion86
04-27-2009, 06:04 AM
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
Ixion86
04-30-2009, 06:50 AM
<BORDO valenza="CONSOLID" esterconf="NO" codbo="5125" dim="18" ang="0.000" posx="11510.594" posy="-11034.836" pintx="11510.594" pinty="-11034.836">
<GBORDO n.isole="0" n.vert="5">
<COORD>11529.949,-11064.927 11529.790,-11023.693 11504.753,-11023.858 11504.205,-11065.080 11529.949,-11064.927</COORD>
</GBORDO>
</BORDO>
<BORDO valenza="CONSOLID" esterconf="NO" codbo="29" dim="18" ang="0.000" posx="11289.885" posy="-11282.869" pintx="11283.582" pinty="-11295.350">
<GBORDO n.isole="0" n.vert="5">
<COORD>11288.433,-11290.674 11279.000,-11290.645 11278.970,-11300.341 11288.022,-11299.810 11288.433,-11290.674</COORD>
</GBORDO>
</BORDO>
<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="12">
<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>
</GBORDO>
</BORDO>
when i process this code,it achieves a multiple loop on BORDO but nothing about VERTISOLA.instead it shows me just VERTISOLA "5" and not VERTISOLA "5" and VERTISOLA "7",that is it doesn't make a multiple loop also on VERTISOLA.
is it possible with just one process to make a multiple loop on BORDO and VERTISOLA?
If it is possible how can i do?
thanks for the reply,
Regards,:):)
Ixion86
MattCasters
04-30-2009, 09:52 AM
is it possible with just one process to make a multiple loop on BORDO and VERTISOLA?
Sorry, that is not possible yet.