ntlcn / xmappr

Automatically exported from code.google.com/p/xmappr
0 stars 0 forks source link

String holding tags changes to < and > #29

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.set the value for a string attribute to be like <id><123></id> in an 
object test
2.add xmappr annotation
3.use xmapper's toXML method to convert the object "test" holding this 
attribute to string.

What is the expected output? What do you see instead?
excepted output: <id><1024></id>
what i see: &lt;id&gt;1024&lt;/id&gt;

What version of the product are you using? On what operating system?
0.9.2

Please provide any additional information below.

Original issue reported on code.google.com by mohamad....@gmail.com on 17 Feb 2010 at 9:39

GoogleCodeExporter commented 8 years ago
Please provide code and XML that reproduces this error. 

Original comment by peter.kn...@gmail.com on 17 Feb 2010 at 12:51

GoogleCodeExporter commented 8 years ago
I've also noticed the same problem. I've used a find and replace regex on the 
xml
that gets produced:
                String formatted = dirtyPayload.replaceAll("(>)", ">");
        String cleanXml = formatted.replaceAll("(<)", "<");

It occurs when you try to use cdata as text (ie @Text )

Original comment by richha...@googlemail.com on 3 Mar 2010 at 12:00

GoogleCodeExporter commented 8 years ago
I tried to use CDATA as XML text, but couldn't map it - this is the correct 
behavior.
CDATA and Text are separate XML nodes and should not be interchanged.

So, I could not reproduce your problem. Please attach code and XML to this 
issue that
reproduces the above error.

Thanks, Peter

Original comment by peter.kn...@gmail.com on 3 Mar 2010 at 3:23

GoogleCodeExporter commented 8 years ago
I basically entered CDATA within an @Text annotated String, so when I 
serialised the
object it replaced < and > with < and >. 
 Is there an annotation for CDATA please?

By the way, when I tried to upgrade to 0.93, my 0.92 classes wouldn't work 

Original comment by richha...@googlemail.com on 4 Mar 2010 at 3:06

GoogleCodeExporter commented 8 years ago
XML has several special characters that must not be used in XML text:

http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Pr
edefined_entities_in_XML

Original comment by peter.kn...@gmail.com on 7 Mar 2010 at 2:15