[jdom-interest] XMLOutputter PI and formatting problem...

Jason Hunter jhunter at acm.org
Tue Aug 7 14:49:52 PDT 2001

> Is there a way to preserve my
> original formatting so that i don't get the rest of my xml file on just the
> 3rd line?

SAX doesn't report whitespace outside of the root element (because it's
irrelevant semantically) so JDOM is never told your formatting.  Thus if
you're using SAXBuilder it can't be preserved.  Andy, would XNI provide
any assistance here?

> * On the beginning of the third line i get a PI, <?ATTLINK img-ref sliid
> "SLI"?>, which was not in the original xml file (but was in the dtd). Why
> does this happen, and is there a way that I can suppress this from appearing
> in the outputted xml file?

SAX reports default attribute values and makes them indistinguishable
from other attributes.  Thus they're included in the document.  It's
possible to give attributes the property if they were included as
defaults (as is done in DOM), but you'd need a builder to support that. 
XNI is a possibility.  SAX is not.


More information about the jdom-interest mailing list