• 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

Issue reading a xml stream with SAXBuilder

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I generate the following xml stream on a server:


and have the following code to read it (the stream is shared as a string "result"):



My issue is: It works "most" of the time without any problem. But from time to time (quite randomly actually), I have the following error:

org.jdom.input.JDOMParseException: Error on line 21 of document http://www.w3.org/TR/html4/frameset.dtd: The declaration for the entity "HTML.Version" must end with '>'.
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:530)



I don't understand why this address http://www.w3.org/TR/html4/frameset.dtd is mentioned. The link is active but it takes ages to reach it. Is there a way to avoid the dtd validation in this context? I thought the line SAXBuilder serviceSxb = new SAXBuilder() was enough to avoid it.

Is there a solution to get a more robust procedure to parse my xml?

I would really appreciate some help here.
Thanks!
 
Author and all-around good cowpoke
Posts: 13078
6
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first possibility that comes to mind is that your service has returned a HTML error message, not the XML document String you are expecting.

I would certainly be checking the returned response for an error code.

Also, try printing or logging the result string.

Bill

 
Jo oZ
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed the string I send from my source and the one I receive right before parsing are different. Which means that something is lost in translation - so I am not reading xml then the error appears.
Sorry for the off-topic then and thanks for your reply and suggestion!
 
Do you pee on your compost? Does this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic