How to change the XML file Root and XmlDeclaration using C#

Posted on 2010-09-01
Medium Priority
Last Modified: 2012-05-10
HI Expert ;

I have the following XML File and I want to process somme modifications as Changing the The  Node name <NewDataSet> to <ActualKPITest> and XMLDeclartion  <?xml version="1.0" standalone="yes" ?>  to  <?xml version="1.0" encoding="utf-8" standalone="yes" ?>

My file is :
  <?xml version="1.0" standalone="yes" ?>
- <NewDataSet>
- <SSISPackageLayout>
  <Description>This represents the version number of auditing framework. This number is updated when auditing framework changes are applied.</Description>

How to do that with C#
Question by:Fatehbourghoud
  • 3
  • 3

Expert Comment

by:Gururaj Badam
ID: 33580503
You can import the xml into DataSet.ReadXml first, then modify the Table name NewDataSet to ActualKPITest and write back to whatever for you need using DataSet.WriteXml overloads

Author Comment

ID: 33580688
The Child Node i <SSISPackageLayout> is my table name I don't want to change it , the probleme is the Dataset.WriteXML  overload create the default Node  <NewDataSet> . and I wnat to replace it

02- what about the changing  XMLDeclartion  <?xml version="1.0" standalone="yes" ?>  to  <?xml version="1.0" encoding="utf-8" standalone="yes" ?>  , any solution ?

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.


Expert Comment

by:Gururaj Badam
ID: 33584210

Author Comment

ID: 33586497
I fixed the bug

Accepted Solution

Gururaj Badam earned 2000 total points
ID: 33586526
wow!! that's good. How?

Author Closing Comment

ID: 33675798

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question