smartTest
12 years agoContributor
[Resolved]Remove Nodes from XML request - Groovy help needed
Hiya
I am working on a test case that uses a property transfer step to move a nodeset from a completed request into another request step. What I need to do before running the next request is to remove some elements of the transferred data but I can't seem to work out the Groovy script required to delete the unwanted nodes following. The request message I want to adjust is:
Where, for instance, I need to remove the <ota:TotalFare Amount="7139.35" CurrencyCode="GBP" DecimalPlaces="2"/> node altogether. I will have multiple of the <ota:PTC_FareBreakdown> nodesets in the request and need to remove the same data in all of them.
Can anyone help me with an easy script for this as I'm a newbie to Groovy scripting.
thanks in advance.
Di
I am working on a test case that uses a property transfer step to move a nodeset from a completed request into another request step. What I need to do before running the next request is to remove some elements of the transferred data but I can't seem to work out the Groovy script required to delete the unwanted nodes following. The request message I want to adjust is:
<ota:PTC_FareBreakdown>
<ota:PassengerTypeQuantity Code="ADT" Quantity="2"/>
<ota:FareBasisCodes>
<ota:FareBasisCode FlightSegmentRPH="1">CIF</ota:FareBasisCode>
<ota:FareBasisCode FlightSegmentRPH="2">CIF</ota:FareBasisCode>
</ota:FareBasisCodes>
<ota:PassengerFare>
<ota:BaseFare Amount="6927.00" CurrencyCode="GBP" DecimalPlaces="2"/>
<ota:Taxes>
<ota:Tax TaxCode="GB" Amount="134.00"/>
<ota:Tax TaxCode="UB" Amount="39.75"/>
<ota:Tax TaxCode="AY" Amount="1.60"/>
<ota:Tax TaxCode="US" Amount="22.60"/>
<ota:Tax TaxCode="XA" Amount="3.30"/>
<ota:Tax TaxCode="XY" Amount="4.60"/>
<ota:Tax TaxCode="YC" Amount="3.60"/>
<ota:Tax TaxCode="XF" Amount="2.90"/>
</ota:Taxes>
<ota:TotalFare Amount="7139.35" CurrencyCode="GBP" DecimalPlaces="2"/>
<ota:UnstructuredFareCalc>LHR <> EWR5220.76CIF <> LHR5220.77CIF NUC10441.53END ROE0.663408</ota:UnstructuredFareCalc>
<ota:FareBaggageAllowance FlightSegmentRPH="1" UnitOfMeasureQuantity="" UnitOfMeasure=""/>
<ota:FareBaggageAllowance FlightSegmentRPH="2" UnitOfMeasureQuantity="" UnitOfMeasure=""/>
<ota:Remark>TKTG AGREEMENT DOES NOT EXIST FOR <> SEE >DX*TA</ota:Remark>
<ota:Remark>LAST TKT DATE 23MAY13-DATE OF ORIGIN</ota:Remark>
<ota:Remark>UNABLE TO VERIFY BOOKING DATE</ota:Remark>
<ota:Remark>- DATE OF ORIGIN</ota:Remark>
<ota:Remark>NO BAGGAGE DISCLOSURE DATA FOR THIS REQUEST</ota:Remark>
<ota:Remark>IATA FARES USED FOR PRICING</ota:Remark>
</ota:PassengerFare>
</ota:PTC_FareBreakdown>
Where, for instance, I need to remove the <ota:TotalFare Amount="7139.35" CurrencyCode="GBP" DecimalPlaces="2"/> node altogether. I will have multiple of the <ota:PTC_FareBreakdown> nodesets in the request and need to remove the same data in all of them.
Can anyone help me with an easy script for this as I'm a newbie to Groovy scripting.
thanks in advance.
Di