// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.EscapeStrategy;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;

public class TagOutput {
    public static void main(String[] args) throws Exception {
        Document doc = new Document();
        Element elm = new Element("tag");
        elm.setText("<andettag>");
        doc.setRootElement(elm);
        Format fmt = Format.getPrettyFormat();
        XMLOutputter xo = new XMLOutputter(fmt);
        xo.outputElementContent(elm, System.out);
        fmt.setEscapeStrategy(new Magick());
        xo.outputElementContent(elm, System.out);
        System.out.println(elm.getText());
    }
}

class Magick implements EscapeStrategy {
    public boolean shouldEscape(char arg0) {
        return false;
    }
}
