I have my xml file in following format---
<Tag_1 Interpolation="true" DefaultSpacing="100">
<Items>
<ValueItem Position="0" Value="40" />
<ValueItem Position="11000" Value="30" />
</Items>
</Tag_1>
<Tag_2 Interpolation="true" DefaultSpacing="100">
<Items>
<ValueItem Position="0" Value="40" />
<ValueItem Position="11000" Value="30" />
</Items>
</Tag_2>
<Tag_3 Interpolation="true" DefaultSpacing="100">
<Items>
<ValueItem Position="0" Value="50" />
<ValueItem Position="37500" Value="50" />
<ValueItem Position="39900" Value="50" />
<ValueItem Position="40000" Value="46" />
<ValueItem Position="43000" Value="43" />
<ValueItem Position="43100" Value="50" />
</Items>
</Tag_3>
<Tag_4 Interpolation="true" DefaultSpacing="100">
<Items>
<ValueItem Position="2000" Value="6" />
<ValueItem Position="45000" Value="6" />
</Items>
</Tag_4>
and I wants to read/get the data from position and value and wants to store that data into the respective ArrayList but don't know how to do it. Please help
Dnyanesh.
To read XML-files you can use System.Xml inluded to .NET Framework.
It works a kind of this:
using System.Xml;
...
XmlDocument MyXmlFile = new XmlDocument();
MyXmlFile.LoadXml(PATH_TO_MY_XML);
// Using
XmlNode xmlValueItem = MyXmlFile.GetElementsByTagName("ValueItem")[0];
string position = xmlValueItem.Attributes["Position"].InnerText;
Google for System.Xml and XPath to work with XML documents.
protected void Page_Load(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("~/Record7.xml"));
XmlDocument xmldoc = new XmlDocument();
Record.DataSource = ds;
Record.DataBind();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.