[jdom-interest] & problems

Bradley S. Huffman hip at a.cs.okstate.edu
Fri Sep 9 06:39:30 PDT 2005


Dirk Schumacher writes:

> Hello,
> 
> and thanks for your responses.
> I am still having troubles to get your points.
> (Probably you do have too, gettin mine.)
> So here in is what I need.
> 
> Some code like this:
> ---------------------------------------
> import java.io.IOException;
> 
> import org.jdom.Element;
> import org.jdom.output.Format;
> import org.jdom.output.XMLOutputter;
> 
> public class Main {
> 
>     public static void main(String[] args) throws IOException {
> 
>     Element e = new Element("body");
>                                 
>     e.addContent("When I was young I loved to watch Simon ? Simon");

Not going to happen without modifing XMLOutputter.

>     e.addContent(new Element("br"));
>     e.addContent("seems to work correct!");
>     Element p = new Element("p");
>     e.addContent(p);
>     p.setText("?nbsp;little indented text.");

      EntityRef ref2 = new EntityRef("nbsp");
      e.addContent(ref2);

JDOM is lazy and doesn't check if a new entity reference is defined in the DTD.

Brad


More information about the jdom-interest mailing list