OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Please help -- Xml errors during network transfer

[ Lists Home | Date Index | Thread Index ]

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





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS