• Post Reply Bookmark Topic Watch Topic
  • New Topic

Illegal XML characters

 
Bob Green
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My webservice response contains illegal xml characters like '&', '#'. I like to know if anyone knows of any Java class I can call to replace these characters with valid xml characters, pls. let me know.

TIA
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think # is an invalid XML character.

The main ones you need to translate are <, > and & in text, and " and ' in attributes.

Here's a very simple bit of Java that I use:

 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!