473,395 Members | 1,442 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,395 software developers and data experts.

XmlDocument save and end tag formatting

Hi,

I am doing some work with the XmlDocument class for loading and saving files
and I notice that the save call is writing out the empty element in the
following format <element /> - is this formatting possible to control? ie.
get it to write out <element></element>.

Thanks

Donal
Nov 15 '05 #1
2 2437
Donal McWeeney wrote:
I am doing some work with the XmlDocument class for loading and saving files
and I notice that the save call is writing out the empty element in the
following format <element /> - is this formatting possible to control? ie.
get it to write out <element></element>.


That's usually bad idea to rely on difference between these two forms,
because they are truly equivalent ones. Do you have some specific needs
or why do want to control such low level syntax sugar?

PS. You can try writing XML via XmlTextWriter with Formatting property
set to Formatting.Indented.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 15 '05 #2
> That's usually bad idea to rely on difference between these two forms,
because they are truly equivalent ones. Do you have some specific needs
or why do want to control such low level syntax sugar?


Agreed - next post on xml comparison tools would get around this - text file
comparison breaks this scenario.

Thanks

Donal
Nov 15 '05 #3

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

Similar topics

2
by: Tom Pearson | last post by:
I have created an XmlDocument and can see that this is correctly formed and has a root element If I Save the doc to a file and reload it all works o If I dump the doc to a stream, again using the...
5
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
3
by: Donal McWeeney | last post by:
Hi, I am doing some work with the XmlDocument class for loading and saving files and I notice that the save call is writing out the empty element in the following format <element /> - is this...
13
by: Matthew Wieder | last post by:
In my C# application, I have class which has method that opens an XML document, modifies it and saves it out. I run that method for several different XML documents. What I've found is that the...
2
by: Mike | last post by:
Hi, When using the following code: doc.PreserveWhitespace = true; doc.Save(fileName); where doc is a variable of type "XmlDocument", the XML file is saved with the correct information by the...
1
by: liuhengyi | last post by:
Hi, I have a test program that creates 5 threads and each thread uses XmlDocument.Save(filename) to save a Xml dom to a file. I have put the lock statement around the Save to prevent from...
3
by: Aaron Sellers | last post by:
Hi all, I have a nicely formatted .xml file that loses that nice formatting when I edit it and use XmlDocument.Save to save the file. Does anyone know of any way to keep the formatting I had when...
3
by: RJA | last post by:
Hiyas, Using VS .net 2003. Setting up a Webservice that accepts 3rd party vendor designed XML requests and returns a filled XMLDocument with response data. Vendor XSDs were serialize into...
2
by: Mr Flibble | last post by:
Hey Folks. If I want to create a simple XMLDocument that contains a few lines of XML which class should I use? I'm a bit confused of the differences and which class to use and when. Ta.
3
by: Stephen Ward | last post by:
I have a simple little project open a xml file change a few nodes save the file, no big deal. The problem is that the doctype is getting modified when I save the file. So it looks like this:...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.