Problem with Data Source

Hi guys,
I am using a list grid having code:

isc.ListGrid.create({
ID: “purchase1”,
width:550, height:300, alternateRecordStyles:true, showAllRecords:true,
dataSource: medDS,
autoFetchData: true
})

code for medDS:–

<DataSource
ID=“medDS”
dataFormat=“xml”
dataURL=“/medicineData.xml”
recordXPath=“//medicine”
><fields>
<field name=“medName” title=“Name”/>
<field name=“price” title=“Price”/>
<field name=“BatchNo” title=“BatchNo”/>
</fields></DataSource>

These things works fine.
But now there is a need where i dont have data in .xml file. Instead, i am having data in XML format that is stored in a java script variable.

Something like:
Var medicineData = "<List>

<medicine>
<medName>Disprin</medName>
<price>20.50</price>
<BatchNo>11234</BatchNo>
</medicine>
<medicine>
<medName>Crocin</medName>
<price>30.50</price>
<BatchNo>11564</BatchNo>
</medicine>
<medicine>
<medName>Merk-200</medName>
<price>31.50</price>
<BatchNo>11521</BatchNo>
</medicine>

</List>"

Now how can i populate the grid using this variable ?

Use XMLTools.parseXML() to obtain an XMLDocument, then use DataSource.recordsFromXML() to obtain an Array of Objects suitable for us as ListGrid.data.