Dataset ds=new DataSet();
ds.ReadXml("path of the xml");
However ds has multiple tables, I would like to fetch out the details tag information of Header and Footer separately:
XElement xElement = XElement.Parse(ds.GetXml().ToString());
var items =xElement
.Descendants("Header");
Above code doesn't yield me the results, it comes back as empty.
How can i get Name & Number tag of Details tag per Header and per Footer? Can i create 2 datasets using ds.ReadXML separtely?
Here is my XML:
<?xml version="1.0" encoding="UTF-8"?>
<Mapping>
<Header>
<Row>
<Details>
<Name>Name</Name>
<DataType>string</DataType>
<Value>Mark</Value>
</Details>
<Details>
<Name>Number</Name>
<DataType>int</DataType>
<Value>1</Value>
</Details>
</Row>
</Header>
<Footer>
<Row>
<Details>
<Name>Name</Name>
<DataType>string</DataType>
<Value>John</Value>
</Details>
<Details>
<Name>Number</Name>
<DataType>int</DataType>
<Value>2</Value>
</Details>
</Row>
</Footer>
</Mapping>
Dataset 1 : Header info - So that i can loop thro' the rows
Dataset 2 : Footer info - So that i can loop thro' the rows
Or is there any other approach to fetch out name, number separately? the objective here is to fetch out the data and build a C# class like
public class Header
{
public Header(){}
public string Name;
public int Number
}
public class Footer
{
public Footer(){}
public string Name;
public int Number
}