G
Guest
when I try to write to an xml doc. it only creates it and never writes to it
heres my code:
private XmlTextWriter xtw;
private void btnSave_Click(object sender, System.EventArgs e)
{
xtw = new XmlTextWriter(@"C:\Videos.xml", null);
xtw.Formatting = Formatting.Indented;
xtw.Indentation = 3;
// Start the XML document.
xtw.WriteStartDocument();
xtw.WriteComment("Video Library");
xtw.WriteComment(
"This is a file containing a number of videos.");
// Add elements to the file
xtw.WriteStartElement("p", "person", "urn
erson");
xtw.WriteStartElement("LastName","");
xtw.WriteString("Chand");
xtw.WriteEndElement();
xtw.WriteStartElement("FirstName","");
xtw.WriteString("Mahesh");
xtw.WriteEndElement();
}
}
}
It creates the file but never writes to it and when I try to open itin ie it gives me an error.
heres my code:
private XmlTextWriter xtw;
private void btnSave_Click(object sender, System.EventArgs e)
{
xtw = new XmlTextWriter(@"C:\Videos.xml", null);
xtw.Formatting = Formatting.Indented;
xtw.Indentation = 3;
// Start the XML document.
xtw.WriteStartDocument();
xtw.WriteComment("Video Library");
xtw.WriteComment(
"This is a file containing a number of videos.");
// Add elements to the file
xtw.WriteStartElement("p", "person", "urn

xtw.WriteStartElement("LastName","");
xtw.WriteString("Chand");
xtw.WriteEndElement();
xtw.WriteStartElement("FirstName","");
xtw.WriteString("Mahesh");
xtw.WriteEndElement();
}
}
}
It creates the file but never writes to it and when I try to open itin ie it gives me an error.