[Mono-list] XmlTextWriter bugs
dietmar
dietmar@ximian.com
21 Jan 2003 13:18:02 +0100
Looks like there are bug in XmlTextWriter. It produces incorrect xml
(missing closing tags)
This produces an empty file instead of <?xml version="1.0"?>
----------------
using System;
using System.Xml;
public class Demo
{
public static void Main(string[] args)
{
XmlTextWriter wr =
new XmlTextWriter("mono.xml", null);
wr.Formatting = Formatting.Indented;
wr.Indentation = 3;
wr.WriteStartDocument();
wr.Flush();
wr.Close();
}
}
---------------
And there is no closing </data> tag with this program:
-------------------
using System;
using System.Xml;
public class Demo
{
public static void Main(string[] args)
{
XmlTextWriter wr =
new XmlTextWriter("/tmp/mono.xml", null);
wr.Formatting = Formatting.Indented;
wr.Indentation = 3;
wr.WriteStartDocument();
wr.WriteComment("Ich bin ein Kommentar");
wr.WriteStartElement("data");
wr.WriteElementString("produkt", "Wurstsemmel");
wr.WriteElementString("produkt", "Brot");
wr.WriteElementString("produkt", "<produkt></produkt>");
wr.WriteEndElement();
wr.Flush();
wr.Close();
}
}
------------------
Any ideas?
- Dietmar