Reputation: 21
I have an XML document with an element that looks something like this:
<element attribute="this
has
line
breaks"/>
When I'm parsing it, this is outputted as:
<element attribute="this
has
line
breaks"/>
It's because, JDOM normalizes all the attribute values at its way, when it's not in an attribute (not in quotes), the value is well outputted. So I would like to know if it's possible to get back the same xml with its line breaks.
Thank you and I hope you understood my english :3
Upvotes: 1
Views: 673
Reputation: 21
I resolved my problem this way, if it can help
XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat().setExpandEmptyElements(true)) {
@Override
public String escapeAttributeEntities(String str) {
str = str.replaceAll("\"", """);
return str;
}
};
Upvotes: 1