473,396 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

Hi,

I am using dataset to read a xml file.

dsData.ReadXml(ConfigurationSettings.AppSettings["xmlpath"].ToString());

i am binding this dataset to a datagrid.

Then i add a new row to dataset

DataRow dr = dsData.Tables[1].NewRow();
dr["ID"] = dsData.Tables[1].Rows.Count;
dr["Numeric-3"] = txtNumeric3.Text;
dr["Alpha-2"] = txtAlpha2.Text ;
dr["Alpha-3"] = txtAlpha3.Text ;
dr["English Short Name"] = txtEShort.Text ;
dr["English Full Name"] = txtEFull.Text ;
dr["French Short Name"] = txtFShort.Text ;
dr["French Full Name"] = txtFFull.Text ;
dsData.Tables[1].Rows.Add(dr);
dsData.AcceptChanges();

And finally, i tried to save xml.

if ( File.Exists(ConfigurationSettings.AppSettings["xmlpath"].ToString()))
File.Delete(ConfigurationSettings.AppSettings["xmlpath"].ToString());
dsData.WriteXml(ConfigurationSettings.AppSettings["xmlpath"].ToString());


I delete existing XML file and try to create new one.

When i tried to write xml, it gives me this error.

Please advice.

Thanks in advance.

Jatin
Mar 12 '08 #1
2 6381
vijay
30
Hi Jatin urfe RAM,

This is Vijay Vaja...........how r u man........i have not much clue on this....but some windows file problem i faced earlier and from there i can tell that.......problem could be you are deleting the file and immediately trying to create the same file on same path.....where system is creating some problem (invalid state).....

Instead deleting and creating new one.........you use option of create file directly (there must be some option to pass as overwrite the file if already exist and avoid manual deletion).

Let me know if this helps....

Regards,
...Vijay
Hi,

I am using dataset to read a xml file.

dsData.ReadXml(ConfigurationSettings.AppSettings["xmlpath"].ToString());

i am binding this dataset to a datagrid.

Then i add a new row to dataset

DataRow dr = dsData.Tables[1].NewRow();
dr["ID"] = dsData.Tables[1].Rows.Count;
dr["Numeric-3"] = txtNumeric3.Text;
dr["Alpha-2"] = txtAlpha2.Text ;
dr["Alpha-3"] = txtAlpha3.Text ;
dr["English Short Name"] = txtEShort.Text ;
dr["English Full Name"] = txtEFull.Text ;
dr["French Short Name"] = txtFShort.Text ;
dr["French Full Name"] = txtFFull.Text ;
dsData.Tables[1].Rows.Add(dr);
dsData.AcceptChanges();

And finally, i tried to save xml.

if ( File.Exists(ConfigurationSettings.AppSettings["xmlpath"].ToString()))
File.Delete(ConfigurationSettings.AppSettings["xmlpath"].ToString());
dsData.WriteXml(ConfigurationSettings.AppSettings["xmlpath"].ToString());


I delete existing XML file and try to create new one.

When i tried to write xml, it gives me this error.

Please advice.

Thanks in advance.

Jatin
Mar 12 '08 #2
Hi Jattu,

How r u ?
I tried to execute ur code except the step of binding GRID, its working fine.

Could u plz send me the error description ?

Thanks
Jasmin
Mar 27 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: David Kantowitz | last post by:
I am trying to wrap a native-C++ DLL in managed C++, to use in a .NET project. The native code is compiled into a DLL, and I have created a .def file that exports the mangled names of the...
13
by: Tony | last post by:
Hi everyone, I am new to javascript (and new to programming). I want to have to drop down menus. One will ask use to select from one of the 50 states. The second one will be ask user to select a...
0
by: Craig Watt | last post by:
Please Help! I have an XML File using the DataPacket standard (am working with Delphi/Informix poeple): <?xml version="1.0" standalone="yes"?> <DATAPACKET version="2"> <METADATA> <FIELDS>...
14
by: Simon Morgan | last post by:
I'm trying to write a function to parse a Reverse Polish Notation string from stdin and return 1 token at a time. For those of you who are unaware an RPN string looks like this: 1 2 + 4 * 3 + ...
2
by: Vinod I | last post by:
Hi Team, When I tryed following code, I am getting the Runtime Error as "The View State is invalid for this page and might be corrupted." Exception Details: System.Web.HttpException: The View...
2
by: Brad | last post by:
I have an intranet app that has just started sporadically getting the following error "The viewstate is invalid for this page and might be corrupted." By sproadic I mean 3-4 times during the past...
3
by: John Hopper | last post by:
I have an xml document, created using xmlTextWriter, at(http://www.supremecourtofohio.gov/rss/docketitems/2006-1942.xml) that won't validate. It fails with "invalid token, document not well...
4
by: jvictor118 | last post by:
I've been using the xml.sax.handler module to do event-driven parsing of XML files in this python application I'm working on. However, I keep having really pesky invalid token exceptions....
4
by: =?Utf-8?B?TmljayBBcmRsaWU=?= | last post by:
Is there a way to access the PSVI value of xs:token types using C# (.NET Framework 2.0)? This issue has been around for some time (see...
2
by: Lan Mind | last post by:
Hello again everybody, My page: http://www.dockhawk.com/ I'm trying to implement some "session security" PHP script mentioned in the "Cross-site request forgery" section of this tutorials...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.