-4

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
  • 37
  • 1
  • 10

2 Answers2

0

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.

Roman
  • 502
  • 7
  • 17
-1
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();
}
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339