.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

XMLDocument Save() Method inserting unwanted line breaks

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :.NET Framework
(Visual Studio 2005, .NET framework ver. 2.0 sp1, C#)   Hi all - I hope there's a some simple solution for this. I have a SQL Server 2005 (.dtsx) SSIS package file which I open and make a slight change to, then save it back. The problem is that the resulting saved file differs from the original, even if i haven't made any programattical changes at all.   Specifically, if i do something like this:   using System.XML; XmlDocument doc = new XmlDocument();doc.Load(DTSXFile);doc.Save("TEST-COPY_" + DTSXFile);   So I found that even if i completely remove any modifications i was making, and break it down so that all I am doing is simply loading the file, and then turning right around and saving it, I get line breaks inserted for nodes that have empty values...I looked over the entire file, and the issue is not happening if there is a value...only in the case where the value is missing.   a line like this in the source file: <DTS:xProperty DTS:Name="VersionBuild">7</DTS:xProperty>   comes over perfectly after saving as this: <DTS:xProperty DTS:Name="VersionBuild">7</DTS:xProperty>   But, in the source file, a line like this (empty value): <DTS:xProperty DTS:Name="VersionBuild"></DTS:xProperty>   will end up looking like this in the TEST-COPY file after saving: <DTS:xProperty DTS:Name="VersionBuil

View Complete Post

More Related Resource Links

Unwanted page breaks in rdlc report



I hav a report that has a table group =Fields!Location.Value

and in the cells I do this

=Avg(IIF(Fields!Contaminant.Value = "Element1", cDbl(Fields!Value.Value), cDbl(0)))

what I am getting is 1 row for each location then there is a pagebreak! what i want is the next location right below the  first I looked through for all the page breaks with no luck. Any ideas?

How to implement save to csv method.


Hi All,

I have customer data saved into my database. when the customer access this data through his login and if clicks save to csv, the data has to be saved into their local machine. I am using asp.net version 1.1 and VS2003. Please help me out.

List Display View - Line Breaks?

Hi, I have customised a list display form to display the content from the list differently. I am having a problem when I try to output the content from a multiline textbox - the display form puts it all on the one line. This is the tag that I am using to display the description <xsl:value-of select="@description"/> Is there another tag that I can use to display the linebreaks in the description field in the list in this output? Thanks in advance for any help Kind Regards, Michael

Line chart with no breaks over empty values

I'm sure that I'm just missing a property but I can't find it.  I have a line chart with a contiguous range of dates on the X-axis.  If the series field has an empty value, I'd like to see the line plotted from the previous non-empty point to the next non-empty point rather than seeing a break in the line for that date.  Thanks in advance.Paul Turley, MVP [Hitachi Consulting] SQLServerBIBlog.com

Is there a way to save a refernece to a method in a Tag property and call that method directly from

Hello, Here is a tough one, probably only answerable by someone who really knows his stuff. In the WPF program below, I would like to completely eliminate the necessity of the "LoadIt" method.  The way I'd like to do it is by saving the address ( or some other appropriate information ) of the method to be called to add a Person or Pet to the Expander's Tag.  Then, when the Add button is clicked, the Expander's Tag is read and the method saved therein is called.  The comments in the code below give the gist of what I would like to happen, if such is possible.  The actual application this will be applied to has many groups to add, thereby making the switch statement in the "LoadIt" method huge.  That is what I would like to avoid. Here is the fully functional test program: XAML: <Window x:Class="MethodAsParameter_01.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Loaded="Window_Loaded" Title="MainWindow" Height="350" Width="525"> <Grid> <ScrollViewer> <StackPanel Name="Root" Orientation="Vertical" ButtonBase.Click="Root_Click" /> </ScrollViewe

How to read/write GIANT text file with no line breaks


I have to process giant XML files that are 6GB+ in size.  The problem is that there are no line breaks in the file, and the XML is improperly formatted (no root element).  Therefore I can't use the XML class to read the file, and I can't open the file in any text editor or even "Type" it in a command window because the 1 line in the file is over 6GB.

The file contains UTF8 characters.  What I want to do is first write a program just to read and display 100 characters at a time so I can look at the contents.  Next I want to be able to create a new file, write a root element, read/write the contents of the file and then write the closing root element.

Can anyone provide a code snippet of how to read and display the file contents 100 characters at a time.  I can then figure out the rest.


How to input line breaks and formating in textbox with multilines ?


I have a web form in which anyone can fill out the information and i recieve the information.

<asp:TextBox ID="Body" runat="server" Columns="55" Height="101px" Rows="30" TextMode="MultiLine"

The problem is while entering the information in this text box, if anyone used enter line or different line or any kind of formatting, as a result i don't get the formatted page or with lines. I see only a paragraph which is very difficult to read and understand.

How to make my textbox compatible with all kind of formatting options so that even if someone paste information from word etc in the text box , i should get the formatter information just like the user pasted the information in the text box...

ISession.Save() method ...help please


Hi all,
Please do not ignore this post because of its length. I tried to provide all possible details required for explaination of the problem, hence the long post.
I am very new to NHibernate. I am facing the problem while inserting (saving) record into db table.
All the mappings and configurations are proper. Because when i debug the code i can see the right properties and relations for the objects loaded into memory, also connection happenes successfully.

Problem in inserting another entity via overriding insert method


I have problem to inserting another entity in overriding method of first entity my code sample is like bellow :

partial void InsertEntity1 ( Entity1 instance )


     Entity2 x = new Entity2() ;

tihs.Entity2s.Add(x) ;





in inserting Entity2 I get Exception "The Operation Cannot be perform for the entity because it is not being change track"


Can we show a line chart on multiple pages with page breaks? SSRS 2008


Hi there,

I am using SSRS 2008. I have a line chart which queries a huge dataset and shows the datapoints really close to each other that the labels and grid-lines are overlapping onto each other. http://oi54.tinypic.com/2vifrb9.jpg

Is there a way to split the chart and show it on different pages.? Thanks in Advance :)


How can I make line breaks to calculated columns?

Hi. I have a problem regarding SharePoint lists. I have several single line text columns on my list and now I want create one combined column by using calculated column. That I can do just by using following formula: [column1] & ", " & [column2]...but I would like to have the final result so that each column value is located in own line. Question is how to do these line breaks to these formulas? I have tried [column1] & "<br>" & [column2]... but it didn't worked.

How to save formatting from a multi-line text box into SQL 2005


Hi Everyone,

I have a web form that has a few multi-line text box controls which the user will enter lots of information in paragraphs.  How can I persist their line breaks and tabs into SQL 2005 so that when the information is retrieved on a different page; the line breaks and formatting is preserved?

Thank you!


Bug in XmlDocument.Save(string)



I have a .NET 3.5 program sometimes throwing IOException from FileStream.Finialize. I think XmlDocument.Save(string) is not closing the file stream, but leave it to the garbage collection. Since I switch to using Save(Stream) and close the stream myself, I don't receive any of the exceptions.


Inserting the integer value in the access db using method.


hi all,

I have a Game developed in c# .net and its access db has the field as:




Mobile No:

so for this i have 2 forms,first which consist of the user information as above field except score,so in my insert query i'm providing only this fields except score.And in second form for the game in my insert query i've passed only score.so basically i want all this 5 information should be saved.so wat i've done is i've given an insert query when the user gives the wrong answer or when he quits the game or finally he wins by giving the last question as right.This is not working properly as i'm getting an error saying:'Number of quer values and destination field are not same'.But this inserts the basic information of the user except the score,also every time it takes the score as '0'.Can i use method in this so that my connection code for insertion query should be written at once and can be called in different situation whenever required.plz assist its urgent!!!!!

thanking you all.


Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

Inserting new row in GridView in ASP.NET 2.0

The GridView was not designed to insert new rows, but there is a way to accomplish this with very little code. This article shows how to do that. The GridView was not designed to insert new rows, but there is a way to accomplish this with very little code.

Save images to SQL CE

Storing binary objects (such as image, office document etc.) into database is a little cumbersome when it comes to retrieval. Hence the most commonly accepted way is only store the file path in the database, and to store the documents on a file share.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend