WriteXML Error

K

Kenneth Keeley

Hi,
I am reading in an xml file into a dataset that I then make changes to
before trying to save the updates to file. When I do I get the following
error:

Token StartElement in state Epilog would result in an invalid XML document

This is a sample of my update code:

{
DataRow dr;

DataView dv = new DataView(myDataSet.Tables[1]);
dv.RowFilter = "guid='" + MyGuidID + "'";

if (dv.Count > 0)
{
dv.Delete(0);
}
dv.RowFilter = "";

// Add the new entry.
dr = myDataSet.Tables[1].NewRow();
dr[0] = MyGuidID;
dr[1] = "Sample Text";

myDataSet.Tables[1].Rows.Add(dr);
myDataSet.WriteXml("c:\\Addrbook2.XML");
}

This is a sample of the incoming XML file.

<?xml version="1.0"?>
<addressBook version="8.0">
<contact>
<fullName><![CDATA[First name Inital Last name]]></fullName>
<email><![CDATA[E-mail Address]]></email>
</contact>
</addressBook>

If I manually remove the version="8.0" from the addressBook entry then the
system works.

Can somebody Help me.
Kenneth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top