• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SaxParserException: XML document structures must start and end within the same entity

 
Alan Shiers
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I'm working with a client/server application and using SaxParser for reading in xml. I get the SaxParserException: XML document structures must start and end within the same entity. I understand what that means, but it isn't applicable! The xml data being used is well-formed. I checked the well-formedness with Stylus Studio to make sure. Here's the data:



The parser generally stops around the </bgcolor> tag.
I'm using Eclypse as my IDE. I'm wondering if there's something wrong with it? Or maybe there's something wrong with the class I'm using for reading in the XML? Followng is the class.

Please advise,

Alan

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess is that your input stream is somehow terminated around the element that throws the exception and the parser gets an "end of file" condition.

What generated this XML file?
If the above is not the answer, I would use a programmer's editor to display the contents in HEX to check that the characters are what they appear to be.

Bill
 
Alan Shiers
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Damn! You were right! Not all of the generated xml went out to stream. It got truncated. Why is that? Here's my method for sending stuff out the wire:



As you can see, I'm using nio package. Is there something I need to be doing there that prevents it from truncating the String?

Alan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic