?
Solved

Formatting XML with XmlTextWriter

Posted on 2003-02-26
1
Medium Priority
?
297 Views
Last Modified: 2013-11-18
I am trying to wrirte XML to a file as text using XmlTextWriter. Everything works fine except the fact that all the empty XML elements in the file are written in the long-hand form:

<info attr1="val"></info>

I would prefer the form

<info attr1="val" />

Is there a way to accomplish this in C#?

Thank you.
0
Comment
Question by:msmolyak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
naveenkohli earned 150 total points
ID: 8028927
There is no setting XmlTestWriter that will help you with this. And for that matter, I don't think there is any thing in Xml namespace that will do it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

719 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