Can someone please steer me in the right direction with this? I want the follwing xml to display hierarchically in a xamDataGrid. As you can see, the structure record itself can be a child of another structure record.
Please help!
<perform_select_product_structure_result? <product_structure> <created_by>METRIX</created_by> <created_dttm>03/07/2008 04:27:59 PM</created_dttm> <model_id>CX500 COMPUTER</model_id> <modified_by>METRIX</modified_by> <modified_dttm>03/07/2008 04:27:59 PM</modified_dttm> <product_id>110800</product_id> <product_structure_id>17</product_structure_id> <quantity>1</quantity> <sequence>1</sequence> <serial_id>cx500-4</serial_id> <user_def2>ud2</user_def2> <product_structure> <created_by>METRIX</created_by> <created_dttm>03/07/2008 04:27:59 PM</created_dttm> <model_id>DX500 DESKTOP</model_id> <modified_by>METRIX</modified_by> <modified_dttm>03/07/2008 04:27:59 PM</modified_dttm> <parent_id>17</parent_id> <product_id>110802</product_id> <product_structure_id>18</product_structure_id> <quantity>1</quantity> <sequence>1</sequence> <serial_id>()117</serial_id> <product_structure> <created_by>METRIX</created_by> <created_dttm>03/07/2008 04:27:59 PM</created_dttm> <model_id>MBX500 MOTHERBOARD</model_id> <modified_by>METRIX</modified_by> <modified_dttm>03/07/2008 04:27:59 PM</modified_dttm> <parent_id>18</parent_id> <product_structure_id>19</product_structure_id> <quantity>1</quantity> <sequence>1</sequence> <product_structure> <created_by>METRIX</created_by> <created_dttm>03/07/2008 04:27:59 PM</created_dttm> <model_id>MEMX500 MEMORY</model_id> <modified_by>METRIX</modified_by> <modified_dttm>03/07/2008 04:27:59 PM</modified_dttm> <parent_id>19</parent_id> <product_structure_id>20</product_structure_id> <quantity>1</quantity> <sequence>1</sequence> </product_structure> <product_structure> <created_by>METRIX</created_by> <created_dttm>03/07/2008 04:27:59 PM</created_dttm> <model_id>VCX500 VIDEO CARD</model_id> <modified_by>METRIX</modified_by> <modified_dttm>03/07/2008 04:27:59 PM</modified_dttm> <parent_id>19</parent_id> <product_structure_id>21</product_structure_id> <quantity>1</quantity> <sequence>2</sequence> </product_structure> </product_structure> <product_structure> <created_by>METRIX</created_by> <created_dttm>03/07/2008 04:27:59 PM</created_dttm> <model_id>HDX500 HARD DRIVE</model_id> <modified_by>METRIX</modified_by> <modified_dttm>03/07/2008 04:27:59 PM</modified_dttm> <parent_id>18</parent_id> <product_structure_id>22</product_structure_id> <quantity>1</quantity> <sequence>2</sequence> </product_structure> </product_structure> <product_structure> <created_by>METRIX</created_by> <created_dttm>03/07/2008 04:27:59 PM</created_dttm> <model_id>MX500 MONITOR</model_id> <modified_by>METRIX</modified_by> <modified_dttm>03/07/2008 04:27:59 PM</modified_dttm> <parent_id>17</parent_id> <product_structure_id>23</product_structure_id> <quantity>1</quantity> <sequence>2</sequence> </product_structure> <product_structure> <created_by>METRIX</created_by> <created_dttm>03/07/2008 04:46:22 PM</created_dttm> <model_id>DX500 DESKTOP</model_id> <modified_by>METRIX</modified_by> <modified_dttm>03/13/2008 03:50:55 PM</modified_dttm> <parent_id>17</parent_id> <product_id>110803</product_id> <product_structure_id>24</product_structure_id> <quantity>1</quantity> <sequence>3</sequence> <serial_id>dx500-1</serial_id> </product_structure> </product_structure></perform_select_product_structure_result>
Hi,
You can set the DataSource of the XamDataGrid to a XmlDocument like the following, however the results may not be what you want since that will display elements as they appear in the xml.
xmlDoc.Load( "../../data.xml" );
this.dp.DataSource = xmlDoc;
For a more structured displaye, use DataSet:
dataSet.ReadXml( "../../data.xml" );
// This is for filtering out child product_structure nodes from the root level.
this.dp.DataSource = dv;
Hope this helps,
Sandip