Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

& character messing up with the webservice's xml response  RSS feed

 
Gustavo Santos
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranches,

I'm returning an OMElement on the webservice method that's called, but the problem is when it has the & ampersand char I cannot get the whole xml, seems that it stops sending the xml from that point on and just go straight to the closing tags.

Does anyone have any idea how to solve this? because sometimes I may return some other weird characters such as japanese, chinese or things like that so I just want to make sure those characters won't mess my xml up.

sample:



result:

Cheers
 
Paul Clapham
Sheriff
Posts: 22531
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not that the ampersand is a "weird" character (as you so rudely describe Japanese and Chinese), it's just that your XML document is not well-formed. You have to escape that character if you use it in a text node:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!