Reading XML content to generate html page dynamically

Posted by Pravambekar under XML on 4/4/2014 | Points: 10 | Views : 1205 | Status : [Member] | Replies : 1
Hello Expert,

Can u help in situation where i have little different requirement ! i have few xls file which contains link based content which navigates to another sheet on click of content.

I need to convert this excel file into xml and want to read this xml in C# asp.net application where i need to show xml content dynamically creating html code ..

Currently i have statically created one xml file which contains node and sub node in the file which i m reading in dataset in code behind and displaying it by created run time html table and binding it to html div. but this does not full fill my requirement as .. few xml file may have nested which is difficult to read in dataset, i have no clue how i can read xml in my own format.

moreover you can suggest if any best alternative available...

Help highly appriciated




Responses

Posted by: Oliver32 on: 4/11/2014 [Member] Starter | Points: 25

Up
0
Down
According to your requirments,I'd like to share you with the following sample codes-Excel to XML using C#
using System;

using System.Data;
using System.Windows.Forms;
using System.Xml;
using System.Data;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
try
{
System.Data.OleDb.OleDbConnection MyConnection ;
System.Data.DataSet ds ;
System.Data.OleDb.OleDbDataAdapter MyCommand ;
MyConnection = new System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source='Specify path here \\xl2xml.xls';Extended Properties=Excel 8.0;");
MyCommand = new System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection);
MyCommand.TableMappings.Add("Table", "Product");
ds = new System.Data.DataSet();
MyCommand.Fill(ds);
MyConnection.Close();
ds.WriteXml("Product.xml");
}
catch (Exception ex)
{
MessageBox.Show (ex.ToString());
}
}


}
}

Or you can refer:
http://code.msdn.microsoft.com/office/How-to-convert-excel-file-7a9bb404
http://www.e-iceblue.com/Knowledgebase/Spire.XLS/Program-Guide/How-to-Use-C-/VB.NET-Convert-Excel-to-XML.html

regards
oliver

Pravambekar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response