[jdom-interest] setIgnoringElementContentWhitespace inoperant ?

Jason Hunter jhunter at xquery.com
Thu Dec 9 14:56:32 PST 2004


> I meant:
> 
> I'm not sure it would be fine to remove white space for mixed elements.
> 
> Eric

Without a DTD saying it's fine, it may not be fine.  That's why XML
parsers don't have the option.

But for some documents (the servlet web.xml file format comes to mind)
boundary whitespace doesn't matter.  Ignorable whitespace removes some
but not all.  So the new features would be to remove more whitespace and
to be able to do it without validation.

Here's the options we could/should have off the top of my head.

Sample doc:

<foo>
   <bar> x </bar>  <!-- comment -->
</foo>


* default    -> preserve whitespace

Produces the same as above.

* ignorable  -> remove what validation says can't matter

Produces:

<foo><bar> x </bar><!-- comment --></foo> if validation's on
Same as original if validation is off.

* full white -> remove all text nodes that are all whitespace

Produces:

<foo><bar>x</bar><!-- comment --></foo>

* trimming   -> full white + remove all bounary whitespace

Produces:

<foo><bar>x</bar><!-- comment --></foo>

-jh-





More information about the jdom-interest mailing list