• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic