[jdom-interest] Problems with Mixed Content and XMLOutputter

Grimm, Markus Grimm at juris.de
Thu Jul 26 04:29:36 PDT 2007



We handle with XML-Documents including elements with mixed-content.


an easy example:




            <Content><P>Hello <B>World</B> how are you?</P></Content>




I have to use Compact-Format to output the document as string. Later
this output is used to create a html-view of the content.

But the outputter-result looks like:  <Content><P>Hello<B>World</B>how
are you?</P></Content>

The space befor <B>World and after World</B> is deleted.

The reason is simple, if you look in the XMLOutputter. But I think it's
a fault?!

In Mixed-Content perhaps I need a single space at those positions. In
such cases of mixed-content they should be handled as spaces in a

They shouldn't be trimed.


So,  I had to pimp the XMLOutputter for my needs. Now he knows what kind
of node a) follows to a text-node or b) follows to an Element.

When it's a) an Element, the text-node isn't right-trimed and it's b) a
text-node so the same text-node isn't left-trimmed. So far so good.


What do the developers think about a own solution in the jdom-package
for this problem?







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20070726/f6df38a5/attachment.htm

More information about the jdom-interest mailing list