[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Please help -- Xml errors during network transfer


fix xml errors
Michael Fisher wrote:
> I am in the process of developing a client-server application that 
> attempts to transfer files efficiently over the web.  In its current 
> form, the client breaks the file into pieces and stores each "chunk" 
> in a DataSet object.  Using the DataSet.WriteXml() method, I create 
> and send a series of Xml documents, each with meta-data and a "chunk" 
> of the file.  The Xml documents are then loaded into a byte[] buffer 
> and sent to the server.  The server, in turn, receives the byte[] 
> buffer, extracts the XML documents as strings and re-constructs the 
> DataSet using DataSet.ReadXml().  All this would be great if I wasn't 
> getting Xml exceptions thrown with great frequency.  The two most 
> common Xml exceptions I am seeing are 1) "There are multiple root 
> elements. Line 36, position 17.", and 2) "This is an unexpected token. 
> The expected token is 'EndElement'. Line 34, position 15."
>  
> I am unable to determine what is causing the first error, despite its 
> frequency of occurence.  There never seems to be anything problematic 
> about Line 36, Position 17.  It is, I believe the 3670th byte in the 
> document.

Check the offset within the data that is received, rather than the data 
that is sent.

> I am able to determine the cause of the second error -- receipt of a 
> partial Xml document.  Basically, some portion of the document is not 
> recieved and consequently there is no end element tag.  I think this 
> is the result of poor flow of control during client-server 
> communication, but I'm still looking for the specific problem.
>  
> The Questions:
>  
> 1)  Can anyone offer suggestions as to how to diagnose/fix problem one?

Use HTTP, rather than trying to invent your own protocol. This might 
avoid protocol bugs in your implementation where you are sending 
message data out of order or whatever.

> 2)  Can anyone offer suggestions as to how to diagnose/fix problem two?

Possibly you are using some kind of buffered output at the client and 
forgetting to flush it.
-- 
Chris Burdess


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.