[jdom-interest] [OT] HTML in XML

Per Norrman pernorrman at telia.com
Thu Apr 22 03:37:49 PDT 2004


Two alternatives:

    String html = "<p>This is html with <br> a break and &.</p>";

    Element escape = new Element("fake");
    escape.setContent(new Text(html));
    new XMLOutputter().output(escape, System.out);

    Element cdata = new Element("fake");
    cdata.setContent(new CDATA(html));
    new XMLOutputter().output(cdata, System.out);

There is no magic, you don't have to do anything special.


Eric VERGNAUD wrote:
> Hi,
> Sorry if this is a little off-topic.
> I need to save nodes for which the text value contais HTML tags like <br>
> Is there an official way to encode "fake" tags as text values in Xml ? What
> is the preferred way for doing this with Jdom ?
> Eric
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

More information about the jdom-interest mailing list