wood burning stoves 2.0*
The moose likes Web Services and the fly likes Why the html symbols & umlauts are not converted during unmarshalling in JAXB1.6?    Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Why the html symbols & umlauts are not converted during unmarshalling in JAXB1.6?    " Watch "Why the html symbols & umlauts are not converted during unmarshalling in JAXB1.6?    " New topic
Author

Why the html symbols & umlauts are not converted during unmarshalling in JAXB1.6?

R Ramesh
Greenhorn

Joined: Oct 08, 2004
Posts: 9
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?

---------------------------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Umschlag[><!ENTITY auml "ä"><!ENTITY ouml "ö"><!ENTITY uuml "ü"><!ENTITY Auml "Ä"><!ENTITY Ouml "Ö"><!ENTITY Uuml "Ü"><!ENTITY szlig "ß">]>
<Error version="1.0" >
<ReturnCode>X</ReturnCode>
<Errorcode>X23</Fehlercode>
<ErrorMsg>Inhalt des Feldes ung�ltig</ErrorMsg>
</Error>
----------------------------------------------------------------------------------------------

Many Thanks in advance
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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 &uuml;). 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 &uuml; 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.
R Ramesh
Greenhorn

Joined: Oct 08, 2004
Posts: 9
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why the html symbols & umlauts are not converted during unmarshalling in JAXB1.6?
 
Similar Threads
orm.xml with JBoss
Facade design pattern in web services
validating xml against xml schema using xml spy
Error while parsing schema
parsing CDATA error