LubaT
LubaT

Reputation: 129

JAXB unmarshal deletes newline

I have a string with newlines in an attribute parameter :

<rule-parameter formattingMethod="NO_FORMATTING_METHOD" type="String" value="Hello,      
My name is luba.   
How are you?"/>

When I unmarshal this xml the object that I get for this property the string is in one line.

What should I do so the java property will also have newline in the string ?

Upvotes: 2

Views: 3322

Answers (1)

bdoughan
bdoughan

Reputation: 149037

An XML parser (including JAXB) will not preserve a newline in an XML attribute.

You will need to move this content to an XML element instead.

Upvotes: 3

Related Questions