PC Review


Reply
Thread Tools Rate Thread

How to control root node name for the DataTable.WriteXML method ca

 
 
=?Utf-8?B?WWl0emhhaw==?=
Guest
Posts: n/a
 
      18th Nov 2005
I am trying to leverage ADO.NET 2.0 DataTable WriteXML method and serialize
datatable as an XML file..

dataTable.WriteXml(xmlFile)

Unfortunately, root node of the output file is always DocumentElement. Is
there way to control the name of the root node for the XML output?

 
Reply With Quote
 
 
 
 
Robbe Morris [C# MVP]
Guest
Posts: n/a
 
      21st Nov 2005
Haven't looked at that yet but what happens when
you programmatically/manually define the table name
in the DataTable class?

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.masterado.net





"Yitzhak" <(E-Mail Removed)> wrote in message
news:956AFA96-52FF-4E1E-825A-(E-Mail Removed)...
>I am trying to leverage ADO.NET 2.0 DataTable WriteXML method and serialize
> datatable as an XML file..
>
> dataTable.WriteXml(xmlFile)
>
> Unfortunately, root node of the output file is always DocumentElement. Is
> there way to control the name of the root node for the XML output?
>



 
Reply With Quote
 
Yitzhak
Guest
Posts: n/a
 
      22nd Nov 2005
Table name creates a placeholder for each row in the resultset.
Root name still stays named as a DocumentElement.
So you will get something like this:
<DocumentElement>
<TableName>
<column1> </column1>
<column2> </column2>
etc.
</TableName>
<TableName>
<column1> </column1>
<column2> </column2>
etc.
</TableName>
</DocumentElement>

"Robbe Morris [C# MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Haven't looked at that yet but what happens when
> you programmatically/manually define the table name
> in the DataTable class?
>
> --
> Robbe Morris - 2004/2005 Microsoft MVP C#
> http://www.masterado.net
>
>
>
>
>
> "Yitzhak" <(E-Mail Removed)> wrote in message
> news:956AFA96-52FF-4E1E-825A-(E-Mail Removed)...
>>I am trying to leverage ADO.NET 2.0 DataTable WriteXML method and
>>serialize
>> datatable as an XML file..
>>
>> dataTable.WriteXml(xmlFile)
>>
>> Unfortunately, root node of the output file is always DocumentElement. Is
>> there way to control the name of the root node for the XML output?
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataSet.WriteXML writes strange node names, why? Sin Jeong-hun Microsoft C# .NET 3 26th Jan 2008 11:10 AM
Menu Control where non selected nodes auto collapse when another root node is chosen. sloan Microsoft ASP .NET 0 3rd Jul 2007 02:55 PM
How to control root node name for the DataTable.WriteXML method Yitzhak Microsoft ADO .NET 0 18th Nov 2005 02:31 PM
XMLImportXML method using getXML/writeXML method on dataset with m =?Utf-8?B?c29mdGVuZ2luZQ==?= Microsoft Dot NET 0 14th Sep 2005 10:41 PM
writexml with root tag Guoqi Zheng Microsoft ASP .NET 2 12th Jan 2004 04:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:51 AM.