Any reason you can't use Jakarta commons' StringEscapeUtils.unescapeHtml() [1] before sending the string to xstream?
[1] http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/StringEscapeUt ils.html -----Original Message----- From: Korrignu [mailto:[email protected]] Sent: Friday, December 09, 2011 11:24 AM To: [email protected] Subject: [xstream-user] Parsing HTML special characters Hi, I'm working with XML file that contains HTML specials characters like "é". I use XStream to build objects according to xml file, but I can't handle this kind of stuff. This is my very simple code : String stoxml = xstream.toXML("a < b"); System.out.println(stoxml); System.out.println(xstream.fromXML(stoxml)); and it works fine : <string>a < b</string> a < b but if my code is : stoxml = xstream.toXML("é"); System.out.println(stoxml); System.out.println(xstream.fromXML(stoxml)); it becomes weird, it prints : <string>&eacute;</string> é and then if my xml file looks like : <blog author="Guilh é rme Silveira"> <entry> <title>first</title> <description>My first blog entry.</description> </entry> <entry> <title>tutorial</title> <description> Today we have developed a nice alias tutorial. Tell your friends! NOW! </description> </entry> </blog> from your (modified) example, it raise an com.thoughtworks.xstream.io.StreamException: : unresolved: é (position:START_TAG <blog author='null'>@1:28 in java.io.InputStreamReader@157fb52) ... Have you an Idea ? Thanks for your time and your help. Regards K. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
