473,414 Members | 1,698 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,414 software developers and data experts.

Error: StartElement state Epilog would result in an invalid XML document

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>
<FIELD attrname="row_id" fieldtype="i8" />
<FIELD attrname="business_unit" fieldtype="string"
SUBTYPE="VarChar" WIDTH="10" />
<FIELD attrname="business_type" fieldtype="string"
SUBTYPE="VarChar" WIDTH="12" />
<FIELD attrname="contact_company_name" fieldtype="string"
SUBTYPE="VarChar" WIDTH="100" />
</FIELDS>
</METADATA>
<ROWDATA>
<ROW row_id="0" business_unit="" business_type=""
contact_company_name="" />
</ROWDATA>
</DATAPACKET>

When I execute the following code I get the error "StartElement state
Epilog would result in an invalid XML document" when I attempt to
write the XML back to file:

Dim new_row As DataRow
Dim ds_batch As DataSet = New DataSet

ds_batch.ReadXml(global.myPath & "\batch.xml")

' Add a row
new_row = ds_batch.Tables("ROW").NewRow

Dim next_id As Integer =
ds_batch.Tables("ROW").Compute("MAX(row_id)", "")
next_id += 1
new_row.Item("row_id") = next_id
new_row.Item("business_unit") = "R"
new_row.Item("business_type") = "A"
new_row.Item("contact_company_name") = "ABC"

ds_batch.Tables("ROW").Rows.Add(new_row)
ds_batch.AcceptChanges()
Console.WriteLine(ds_batch.GetXml)
ds_batch.WriteXml(global.myPath & "\batch.xml")

The ds_batch.GetXml function returns the following XML:

<DATAPACKET version="2">
<METADATA>
<FIELDS>
<FIELD attrname="row_id" fieldtype="i8" />
<FIELD attrname="business_unit" fieldtype="string"
SUBTYPE="VarChar" WIDTH="10" />
<FIELD attrname="business_type" fieldtype="string"
SUBTYPE="VarChar" WIDTH="12" />
<FIELD attrname="contact_company_name" fieldtype="string"
SUBTYPE="VarChar" WIDTH="100" />
</FIELDS>
</METADATA>
<ROWDATA>
<ROW row_id="0" business_unit="" business_type=""
contact_company_name="" />
</ROWDATA>
</DATAPACKET>
<ROW row_id="1" business_unit="R" business_type="A"
contact_company_name="ABC" />

Obviously the document is mal-formed because the new ROW element has
been added to the end of the file.

Does anyone have a workaround for this?

Thanks in advance,
Craig
Nov 12 '05 #1
0 2291

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: muser | last post by:
Can anyone run this program through their compiler or if they can see a logical error please point it out. I have my tutor working on it at the moment but I would rather a less ambigious response...
1
by: H.L Bai | last post by:
hi, everybody i meet a parse error when i used the xml4c. any proposal is helpful. The error is following .../XMLRegionHandler.h:59 parse error before '*' .../XMLRegionHandler.h:60 parse...
4
by: Filippo Pandiani | last post by:
SCENARIO ======================================= I have a Grid and I want to save the values on an XML. Let me say that I am NOT using DataSet to load valus on my grid. PROBLEM...
0
by: Fabrice Meichtry | last post by:
hi everybody, I still have some difficulties to acces a web service created in C# with soap toolkit.. In fact I'd like to access it with the low-level sample that was on the sample exemple. ...
1
by: Kenneth Keeley | last post by:
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...
3
by: Abdessamad Belangour | last post by:
Hi all, I have developped an application that generate XML documents. At most time it works fine, but sometimes (when the size of data to export is big) i got the error message : << The...
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...
0
by: Kenneth Keeley | last post by:
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...
3
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.