aspose file tools*
The moose likes XML and Related Technologies and the fly likes Don't turn & to & Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Don Watch "Don New topic
Author

Don't turn & to &

Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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 ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Don't turn & to &
 
Similar Threads
Reference to entity must end with ;
What are you RPG guys doing?
apostrophe not getting rendered correctly
Transforming >><<text message>><< this kind of message into CDATA
Get the AMP out