Iam using JAXB1.6 to convert the below xml to java object. After unmarshalling when I print the contents for ErrorMsg element, JAXB doesn't do any conversion for & and the character mentioned in ENTITY in the xml. It just prints as such what is in the xml. Where as i need the output as like " Inhalt des Feldes ung� >ig "
Could you please tell that do I need set any property while unmarshalling or do I need to specify any option in xjc compiler while creating JAXB classes?
Would it be correct to say that the actual data in your XML document looks like this?I can't guess what you meant you needed the "output" to look like, but maybe you could clarify that, and why you need it to look like that. For background information about your question, the entities you have in that document describe to the parser how it should decipher certain pieces of text (such as ü). There is nothing that requires users of that document to keep track of where those entities were used, or to use the entities again when serializing from internal form to XML.
In other words, when a parser converts that XML document to internal form, it will convert the entity ü to the character ü. It may tell the program that called the parser that it did an entity conversion, but that's all. It is not permitted to leave the entity unchanged in the text, because that would amount to changing the text.
Joined: Oct 08, 2004
Thanks paul for your perfect explanation. I get confused while posting this query. Yes, you are right, parser does the character conversion by reading the characters in entity element against the value in the xml element.
Thank you very much for your help.
subject: Why the html symbols & umlauts are not converted during unmarshalling in JAXB1.6?