[jdom-interest] & problems

Dirk Schumacher greyshine at gmx.net
Fri Sep 9 00:27:32 PDT 2005


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");
    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.");
    e.addContent("makes me crazy!");
                                
    Format format = Format.getPrettyFormat();
    format.setEncoding("ISO-8859-1");
    XMLOutputter outputter = new XMLOutputter( format );

    outputter.output(e, System.out);
    }
}
---------------------------------------
Wherever there are question marks '?' I want to know
what I would have to put there.
The output is what I need. It is a must.
So I do no not care what the java code would look like then.

Having an output like this:
---------------------------------------
<body>
  When I was young I loved to watch Simon & Simon
  <br />
  seems to work correct!
  <p>&nbsp;little indented text.</p>
  makes me crazy!
</body>
---------------------------------------
Thank you in advance,
DIrk



More information about the jdom-interest mailing list