Hi,
I have the following XML file (sample):
<CATEGORY name="cat1" id="1">
---<PRODUCT ITEM="100">
------<WEIGHT>0.15</WEIGHT>
------<NAME>A Product</NAME>
------<PRICE>10.00</PRICE>
---</PRODUCT>
</CATEGORY>
<CATEGORY name="cat2" id="2">
---<PRODUCT ITEM="200">
------<WEIGHT>0.15</WEIGHT>
------<NAME>Another Product</NAME>
------<PRICE>20.00</PRICE>
---</PRODUCT>
</CATEGORY>
I use the following code to load the XML into a dataset and build a table of "products":
Dim ds As New DataSet
Dim streamRead As New System.IO.FileStream(AppSettings.Item("SECURED_ASSETS_PATH") & "App_Data/products.xml", System.IO.FileMode.Open)
ds.ReadXml(streamRead)
streamRead.Close()
dt = ds.Tables("product")
My question, how can I load the XML into a dataset but only select products (or load products) from the category named "cat1"? I'd like to either load into the dataset all products in all categories and then be able to select products from a particular category, otherwise load just the products from one category that I choose.
Thanks in advance for helping.
I have the following XML file (sample):
<CATEGORY name="cat1" id="1">
---<PRODUCT ITEM="100">
------<WEIGHT>0.15</WEIGHT>
------<NAME>A Product</NAME>
------<PRICE>10.00</PRICE>
---</PRODUCT>
</CATEGORY>
<CATEGORY name="cat2" id="2">
---<PRODUCT ITEM="200">
------<WEIGHT>0.15</WEIGHT>
------<NAME>Another Product</NAME>
------<PRICE>20.00</PRICE>
---</PRODUCT>
</CATEGORY>
I use the following code to load the XML into a dataset and build a table of "products":
Dim ds As New DataSet
Dim streamRead As New System.IO.FileStream(AppSettings.Item("SECURED_ASSETS_PATH") & "App_Data/products.xml", System.IO.FileMode.Open)
ds.ReadXml(streamRead)
streamRead.Close()
dt = ds.Tables("product")
My question, how can I load the XML into a dataset but only select products (or load products) from the category named "cat1"? I'd like to either load into the dataset all products in all categories and then be able to select products from a particular category, otherwise load just the products from one category that I choose.
Thanks in advance for helping.