[jdom-interest] generating html content with jdom

Noam Tamim noamt at yahoo.com
Fri Jun 29 07:54:02 PDT 2001

> > *  Is it acceptable to use jdom (or any other dom-based application) for
> > creating html documents, or I should stick to just out.println() the
> > elements myself?
> Sure. Why not? As long as you accept the limitations of XMLOutputter
> wrt whitespace and stuff.  JDOM generates street-legal close tags for
> <br /> and the like.

The output from XMLOutputter is fine; I love html files that are

> > *  what's the best way to send a space character? I mean, there's a
> > cell (<td>) that's supposed to be empty. With "standard" html I'd use
> > "<td>&nbsp;</td>".  Currently what I have is this:
> >  new Element("td").addContent(new EntityRef("#160"));
> > Is this the right solution?
> I'd think new EntityRef("nbsp") would work fine.

As far as I remember from the XML specs, nbsp is not a built-in entity. I
can only use it if I declare the DOCTYPE as the xhtml DOCTYPE.

 - Noam.

More information about the jdom-interest mailing list