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 &lt; b</string>
a < b

but if my code is :
stoxml = xstream.toXML("&eacute;");
System.out.println(stoxml);
System.out.println(xstream.fromXML(stoxml));

it becomes weird, it prints :
<string>&amp;eacute;</string>
&eacute;

and then if my xml file looks like :
<blog author="Guilh &eacute; 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: &eacute;
(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.


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to