unintentionally modified whitespace in attribute values

M

Markus

Hello *,

doing some experiments with dom4j, I experience modifications of
- and
-entities
in attribute values:
running a filter, which first deserialises the xml-stream, performs some dom transformations
and then serialises the dom, in a first run, the entities mentioned get converted to
line-feeds {a fact, I could live with, since it's near loss-less}, which in a second run
through the filter will be converted to blanks. And this is, what I don't want to live with.
BTW: other SGML-entities in attributes are not touched.

Reading quite a bunch of docs and fiddling with the obvious parameters, I don't find a way
to let those entities be left unmodified. May be, this behaviour is not only a peculiarity
of dom4j, but of other XML-processors too.

Any ideas???

Markus



PS: setup of reader and writer:
-------8<------
// give reader...
; setReader(new SAXReader())
; getReader().setStripWhitespaceText(true)
; getReader().setMergeAdjacentText(true)
; getReader().setStringInternEnabled(true)

// ... and writer some reasonable defaults:
; setEncoding(new String("UTF-8"))
; setOutput_format(new OutputFormat("\t", true, getEncoding()))
; getOutput_format().setExpandEmptyElements(false)
; setWriter(new XMLWriter(getOutput_format()))
-------8<------
 
R

Richard Tobin

Markus said:
doing some experiments with dom4j, I experience modifications of
-
and
-entities in attribute values:

These should be unchanged by the parser. That is, the parsed data
should contain linefeed and carriage-return characters. It's more
likely to be a problem with the serializer: serializers tend to be
less well tested than parsers, and some incorrectly don't output these
characters as references when they would otherwise be changed on input
(as they would be in attributes).

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top