Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Don't turn & to &

 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For reasons way to strange to explain, we get XML from a web service, parse via SAX, regenerate a subset of the XML to a string, then pass that to JAXB.
The web service sends us ampersands, like in company names, as +amp; which is wonderful. The SAX parser delivers this to us in chars() as a normal ampersand. We put that into the regenerated XML and the JAXB parser croaks. We should be putting +amp; back in there.
Actually, we fixed this for +amp; And the next special character that blew up, and the next one. Now I'd like to do one of two things:
* Definitively fix all charcters that can possibly cause trouble.
* Tell the SAX parser the first time around to stop converting +amp; to &
The second is cleaner, of course. Any ideas how to do that? Or a complete list of special chars?
Thanks!!!
===
Edited to put + for ampersand cause HTML browser was fixing it again. Dang. Also I found the five predefined general entities in the XML docs so I'm more confident of our fix on the fly solution, even though I still don't like it much.
[ July 09, 2003: Message edited by: Stan James ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic