[jdom-interest] Problems outputting HTML

Robert Taylor rtaylor at mulework.com
Tue Apr 27 14:10:18 PDT 2004

Jason, thanks for responding.

I'll try your suggestions.


> -----Original Message-----
> From: Jason Hunter [mailto:jhunter at xquery.com]
> Sent: Tuesday, April 27, 2004 7:40 PM
> To: Robert Taylor
> Cc: jdom-interest at jdom.org
> Subject: Re: [jdom-interest] Problems outputting HTML
> > <script language="JavaScript" src="http://www.newatlanta.com/shared/us.js"></script>
> > 
> > Although the body of this tag is empty, it is expanded because, if it is not, then
> > some browsers won't import the script library.
> I've hit that browser bug too.  I think adding a space of text content 
> between the script tags is also helpful on some browsers, and a 
> convenient workaround to the issue you have here.
> > It appears that unless I set expandEmptyElements(true), then XMLOutputter
> > will collapse empty elements (although this is not stated in the Javadocs).
> > (It seems like there should be an collapseEmptyElements(boolean flag) since
> > <tag></tag> is still well-formed XML..)
> Semantically the expanded and unexpanded forms are identical.  You're 
> just trying to work around browser bugs.  We have the 
> expandEmptyElements() option specifically for this.
> > Not a problem...until <br/> tags are expanded. The browser interprets both
> > <br> and <br/> as line breaks!
> It's <br> and </br> actually, which a decent browser shouldn't see as 
> two breaks.  Argh.
> > One solutions was proposed over a year ago (sublass XMLOutputter and implement an HTMLOutputter...)
> > http://www.servlets.com/archive/servlet/ReadMsg?msgId=335507&listName=jdom-interest
> > 
> > Is this still the case? Are there any other solutions?
> No one's bothered with an HTMLOutputter yet.  For you adding a space in 
> the script element and leaving empties unexpanded would fix the issue.
> -jh-

More information about the jdom-interest mailing list