A
alberto
I'd like to write a xml file like this:
<?xml version="1.0"?>
<a>
<b>
<value>abc</value>
</b>
<c>
<value>def</value>
</c>
</a>
I'm doing this:
XmlTextWriter tw = new XmlTextWriter(fileName, null);
tw.WriteStartDocument();
tw.WriteStartElement("b");
tw.WriteElementString("value", "abc");
tw.WriteEndElement();
tw.WriteStartElement("c");
tw.WriteElementString("value", "def");
tw.WriteEndElement();
tw.WriteEndDocument();
But in the second "WriteStartElement" fails. The compiler says that
StartElement is in the state "Epilog" and there will be an xml document
not valid.
Thank you.
<?xml version="1.0"?>
<a>
<b>
<value>abc</value>
</b>
<c>
<value>def</value>
</c>
</a>
I'm doing this:
XmlTextWriter tw = new XmlTextWriter(fileName, null);
tw.WriteStartDocument();
tw.WriteStartElement("b");
tw.WriteElementString("value", "abc");
tw.WriteEndElement();
tw.WriteStartElement("c");
tw.WriteElementString("value", "def");
tw.WriteEndElement();
tw.WriteEndDocument();
But in the second "WriteStartElement" fails. The compiler says that
StartElement is in the state "Epilog" and there will be an xml document
not valid.
Thank you.