Hi Buddy,
I have a requirement which is explained as below:
1. My input xml file is as shown:
<input>
<historicalObservation>
<observationDate>20110111</observationDate>
<observedRate>14.74</observedRate>
<observationWeight>1</observationWeight>
<observationType>fixing</observationType>
</historicalObservation>
<historicalObservation>
<observationDate>20110111</observationDate>
<observedRate>10.28</observedRate>
<observationWeight>2</observationWeight>
<observationType>fixing</observationType>
</historicalObservation>
<historicalObservation>
<observationDate>20110111</observationDate>
<observedRate>27.96</observedRate>
<observationWeight>3</observationWeight>
<observationType>fixing</observationType>
</historicalObservation>
<historicalObservation>
<observationDate>20110111</observationDate>
<observedRate>4.94</observedRate>
<observationWeight>4</observationWeight>
<observationType>fixing</observationType>
</historicalObservation>
<historicalObservation>
<observationDate>20110225</observationDate>
<observedRate>14.18</observedRate>
<observationWeight>1</observationWeight>
<observationType>fixing</observationType>
</historicalObservation>
<historicalObservation>
<observationDate>20110225</observationDate>
<observedRate>9.21</observedRate>
<observationWeight>2</observationWeight>
<observationType>fixing</observationType>
</historicalObservation>
<historicalObservation>
<observationDate>20110225</observationDate>
<observedRate>29.68</observedRate>
<observationWeight>3</observationWeight>
<observationType>fixing</observationType>
</historicalObservation>
<historicalObservation>
<observationDate>20110225</observationDate>
<observedRate>4.68</observedRate>
<observationWeight>4</observationWeight>
<observationType>fixing</observationType>
</historicalObservation>
</input>
Now, i want to extract the data which should look like this:
Date Rate1 Rate2 Rate3 Rate4 20110111 14.74 10.28 27.96 4.94 20110225 14.18 9.21 29.68 4.68
the logic is something like this:
"For each 'observationDate' value, pick the 'observedRate' value and populate under Rate1 or Rate2 or Rate3 or Rate4. Again the exact 'Rate' column is determined by the 'observationWeight' value."
the above logic should be applied to all the dates in the input xml file and the output should be displayed as matrix as shown above.
If not the matrix, can anybody tell atleast the logic to retrieve the values.
Thanks a lot in advance...Will be waiting for your response....