Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] Problems outputting HTML

Robert Taylor

2004-04-27

Replies:

Greetings, I'm trying to use Outputter to output the contents of an Document
as a string so I can populate the body of an email message and am running into
some frustrations.

The problems stem from the fact that I have the following code which imports
Javascript functions.

<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 also use <br/> in various places for formatting reasons.

I must adjust the format (Explicitely set the Format for the XMLOutputter)
of the document so it won't output the declaration. (Yes, I also have the
<xsl:output method="html"/> set in the XSL document)

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..)

Not a problem...until <br/> tags are expanded. The browser interprets both
<br> and <br/> as line breaks!

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?

robert
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.