In fact my problem is this one : http://jira.codehaus.org/browse/XSTR-334
...
my symbols like é avec defined in my dtd like this :
<!ENTITY eacute "é" ><!-- small e, acute accent -->
if I put in my xml file é instead of é it works.
Infortunately, I can't, this xml file is provided to me and I can't
modify it.
So is these a way to load the dtd before invoking xstream.readObject ?
Thx
K.
On 12/09/2011 05:38 PM, Mark Herman wrote:
> 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.
>
>
signature.asc
Description: OpenPGP digital signature
