I have an XML which is supplied by a third party and I have no control over its formatting. It looks like this:
[code]
<quote_detail rate=“3.375” price="-0.440">
value
</quote_detail>
<quote_detail rate=“3.548” price="-0.230">
value
</quote_detail>
<quote_detail rate=“3.799” price=“1.120”>
value
</quote_detail>
What I need to do is return the result (vendor_name, rate and price) that has a price closest to zero without going over as well as the next two above and below. The ideal result would look something like this (where the middle one is closest to zero):
- Company Z / 3.875 / -1.375
- Company Y / 3.750 / -0.875
- Company X / 3.375 / -0.440
- Company A / 3.500 / 0.250
- Company B / 3.375 / 1.125
I’m not sure about the logic required to do this or how to preserve the XML information while running said logic. Any help?