K
Ken Wilson
I am writing and .xml file and am not getting the formatting I would
like. The portion of the code that is giving me problems is as
follows;
XmlTextWriter tw = new XmlTextWriter(filename);
tw.Formatting = Formatting.Indented;
tw.WriteStartDocument();
tw.WriteStartElement("MyRoot");
tw.WriteStartElement("MyString);
tw.WriteString("This is the string");
tw.WriteEndElement();
tw.WriteEndElement();
tw.WriteEndDocument();
tw.Flush();
tw.Close();
The output I get is formatted as follows.
<?xml version="1.0"?>
<MyRoot>
<MyString>This is the string</MyString>
</MyRoot>
My questions is how do I get the MyString tags and the string itself
to each appear on consecutive lines, i.e.
<MyString>
This is the string
</MyString>
Ken Wilson
Seeking viable employment in Victoria, BC
like. The portion of the code that is giving me problems is as
follows;
XmlTextWriter tw = new XmlTextWriter(filename);
tw.Formatting = Formatting.Indented;
tw.WriteStartDocument();
tw.WriteStartElement("MyRoot");
tw.WriteStartElement("MyString);
tw.WriteString("This is the string");
tw.WriteEndElement();
tw.WriteEndElement();
tw.WriteEndDocument();
tw.Flush();
tw.Close();
The output I get is formatted as follows.
<?xml version="1.0"?>
<MyRoot>
<MyString>This is the string</MyString>
</MyRoot>
My questions is how do I get the MyString tags and the string itself
to each appear on consecutive lines, i.e.
<MyString>
This is the string
</MyString>
Ken Wilson
Seeking viable employment in Victoria, BC