Hi Guys, i have parsed an xml file below and want to create another class with data structure and pass these values to those data structure.
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.XPath;
using System.Diagnostics;
namespace ScormTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Array[] itemcoll = null;
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog op = new OpenFileDialog();
if (op.ShowDialog() == DialogResult.OK)
{
string xmlFilename = op.FileName;
//XmlTextReader reader = new XmlTextReader(xmlFilename);
XmlDocument xDoc = new XmlDocument();
xDoc.Load(xmlFilename);
XmlNodeList title = xDoc.GetElementsByTagName("title");
MessageBox.Show("Title" + title[0].InnerText);
XmlNodeList item = xDoc.GetElementsByTagName("item");
for (int i = 0; i < item.Count; i++)
{
MessageBox.Show("Item" + item[i].InnerText);
}
XmlNodeList fl = xDoc.GetElementsByTagName("file");
for (int j = 0; j < fl.Count; j++)
{
XmlAttributeCollection att = fl[j].Attributes;
MessageBox.Show(att[0].Value);
}
}
what i want to do is to create another class and create datastructure and then assign the value of nodelist and attribute to those data stucture.Can anyone help me with this.
Thanks