Re: Create xml with formatting
- From: Piotr Szukalski <amigos_@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 25 Aug 2005 10:57:28 +0200
On Thu, 25 Aug 2005 00:41:02 -0700, cnu wrote:
Hi!
> System.Xml.XmlTextWriter xtw = new XmlTextWriter(aFilePath, null);
> xtw.Formatting = Formatting.Indented;
> xmlDoc.Save(xtw);
> xtw.Flush();
> xtw.Close();
It looks like you have found a bug in .NET XmlWriter :/
The code below seems to proove it... Any MVP here?
// --- the code ---
System.Xml.XmlTextWriter xtw = new XmlTextWriter(@"c:\temp\aTest.xml", System.Text.Encoding.UTF8);
xtw.Formatting = Formatting.Indented;
xtw.WriteStartElement("Message");
xtw.WriteStartElement("Parent");
xtw.WriteAttributeString("Index", "0");
xtw.WriteAttributeString("Length", "6");
xtw.WriteString("123"); // get rid of this line and everything is ok
xtw.WriteStartElement("Child1");
xtw.WriteAttributeString("index", "0,1");
xtw.WriteAttributeString("length", "6");
xtw.WriteString("abcd");
xtw.WriteEndElement();
xtw.WriteEndElement();
xtw.WriteEndElement();
xtw.Flush();
xtw.Close();
// --- end ---
Cheers,
Piotrek
.
- References:
- Create xml with formatting
- From: cnu
- Re: Create xml with formatting
- From: Piotr Szukalski
- Re: Create xml with formatting
- From: cnu
- Create xml with formatting
- Prev by Date: Downloadable version of Microsofts "Design Guidelines for Class Library Developers"?
- Next by Date: Re: Dropdown lists and arabic numerals
- Previous by thread: Re: Create xml with formatting
- Next by thread: VB.NET Console Application from Windows 2K SP4
- Index(es):
Relevant Pages
|