M
Maziar Aflatoun
Hi everyone,
I like to use the dataset object for reading the following XML.
<?xml version="1.0" encoding="utf-8"?>
<ORDERS>
<ORDER>
<GENERALCONTACT>
<FirstName>FirstName1</FirstName>
<LastName>LastName1</LastName>
<Company>Company1</Company>
</GENERALCONTACT>
<PRODUCTS>
<PRODUCT>
<NAME>Product A</NAME>
<PRICE>$10.99</PRICE>
</PRODUCT>
<PRODUCT>
<NAME>Product B</NAME>
<PRICE>$5.99</PRICE>
</PRODUCT>
</PRODUCTS>
</ORDER>
<ORDER>
<GENERALCONTACT>
<FirstName>FirstName2</FirstName>
<LastName>LastName2</LastName>
<Company>Company2</Company>
</GENERALCONTACT>
<PRODUCTS>
<PRODUCT>
<NAME>Product C</NAME>
<PRICE>$21.99</PRICE>
</PRODUCT>
<PRODUCT>
<NAME>Product D</NAME>
<PRICE>$6.99</PRICE>
</PRODUCT>
</PRODUCTS>
</ORDER>
</ORDERS>
Question 1. How do I just read the products for 1 order only? if I do
dsXMLOrder.Tables["PRODUCT"].Rows.Count;
it will return 4.
Question 2. If I was to add attributes to the above XML. Is it possible to
read attributes from a dataset loaded from an XML file?
Thank you
Maz A.
I like to use the dataset object for reading the following XML.
<?xml version="1.0" encoding="utf-8"?>
<ORDERS>
<ORDER>
<GENERALCONTACT>
<FirstName>FirstName1</FirstName>
<LastName>LastName1</LastName>
<Company>Company1</Company>
</GENERALCONTACT>
<PRODUCTS>
<PRODUCT>
<NAME>Product A</NAME>
<PRICE>$10.99</PRICE>
</PRODUCT>
<PRODUCT>
<NAME>Product B</NAME>
<PRICE>$5.99</PRICE>
</PRODUCT>
</PRODUCTS>
</ORDER>
<ORDER>
<GENERALCONTACT>
<FirstName>FirstName2</FirstName>
<LastName>LastName2</LastName>
<Company>Company2</Company>
</GENERALCONTACT>
<PRODUCTS>
<PRODUCT>
<NAME>Product C</NAME>
<PRICE>$21.99</PRICE>
</PRODUCT>
<PRODUCT>
<NAME>Product D</NAME>
<PRICE>$6.99</PRICE>
</PRODUCT>
</PRODUCTS>
</ORDER>
</ORDERS>
Question 1. How do I just read the products for 1 order only? if I do
dsXMLOrder.Tables["PRODUCT"].Rows.Count;
it will return 4.
Question 2. If I was to add attributes to the above XML. Is it possible to
read attributes from a dataset loaded from an XML file?
Thank you
Maz A.