473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

convert from excel xmlmap export format to dataset?

SL
Hi - I'm fairly new to manipulating xml and I have an excel workbook and on one of the sheets is apparently a listobject... using it's xmlmap.export function I get an xml file that looks like this (truncated of course, you get the idea):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns1:TransactionDetails xmlns:ns1="urn:Microsoft.IT.LicensePosition" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<ns1:Trans>

<ns1:Tran>

<ns1:CustomerName>CUNNINGHAM LINDSEY</ns1:CustomerName>

<ns1:UsageCountryName>United States</ns1:UsageCountryName>

<ns1:PartNumber>227-00367</ns1:PartNumber>

</ns1:Tran>

<ns1:Tran>

<ns1:CustomerName>Cunningham Europe</ns1:CustomerName>

<ns1:UsageCountryName>Netherlands</ns1:UsageCountryName>

<ns1:PartNumber>070-01340</ns1:PartNumber>

</ns1:Tran>

</ns1:Trans>

</ns1:TransactionDetails>

I thought I could load the XML string into an XMLDataDocument and get a DataSet out of that, but it's not working. I have:

list.XmlMap.ExportXml(out xmldata);
System.Xml.XmlDataDocument doc = new XmlDataDocument();

doc.LoadXml(xmldata);

DataSet ds = doc.DataSet;

But the resulting dataset has no tables... Is there a simple way I can transform the xml into something that can be interpreted as a dataset?

Thanks in advance,
Sheryl
Jan 25 '06 #1
1 2048
Hi Sheryl,

The DataGridView might not display the whole dataset, but only a table.
Also, it's better to create an XmlDataDocument from a DataSet, not DataSet
from the XmlDataDoucument. You can load the xml into a DataSet directly
using ReadXml. The data will be put in the 2nd table.

DataSet ds = new DataSet();
ds.ReadXml(@"..\..\XMLFile1.xml");

this.dataGridView1.DataSource = ds.Tables[1];

It is reading xml from an external file. You can also change the filename
to a stream.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Jan 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Hans [DiaGraphIT] | last post by:
Hi! I want to export a dataset to an excel file. I found following code on the net... ( http://www.codeproject.com/csharp/Export.asp ) Excel.ApplicationClass excel = new ApplicationClass();...
8
by: ChrisBowringGG | last post by:
When you use Application.Quit() on an Excel application, there can still be an instance of Excel running, as seen in Task Manager. You can try following the advice on MSDN: ...
4
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a...
7
by: postings | last post by:
Hi - can you help please? Please review the following straightforward code which works fine with ordinary XML files. ---------------------------------------------------------------- Dim...
4
by: John Z. | last post by:
I have read numerous articles and postings on various approaches to exporting a DataSet to excel while avoiding the use of automation. I found the most performant approach to be assigning a...
0
by: Cassidy | last post by:
Hi, Using the Excel object in Visual Studio 2005 I'm trying to export an Excel ObjectList to a string as XML. I'm trying to read out the three columns referenced my an Excel Range, but when I...
2
by: noopathan | last post by:
Hi experts , I have an excel file in the below format --------------------------------------------------------------------- CodeID CodeName Market Name Date...
9
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
7
by: TG | last post by:
hi! I am trying to create a sql server table from an excel sheet. Here is the code I have: 'This procedure the xlsx file and dumps it to a table in SQL Server
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.