<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2653.12">
<TITLE>RE: [jdom-interest] Problems with '&lt;' and '&gt;' in element.addContent()</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>&quot;But im not certain JDOM is good for html as valid html is not nesesarily </FONT>
<BR><FONT SIZE=2>valid xml.&quot;</FONT>
</P>

<P><FONT SIZE=2>yes. i accept that. But is there a better way of converting JDOM to HTML ? </FONT>
<BR><FONT SIZE=2>I am not convinced with converting JDOM to streamsource and coverting into </FONT>
<BR><FONT SIZE=2>HTML using XSLT. how much is the performance loss ?</FONT>
</P>

<P><FONT SIZE=2>Is there a native XSLT for JDOM available ?</FONT>
</P>

<P><FONT SIZE=2>thanks,</FONT>
<BR><FONT SIZE=2>mani</FONT>
</P>
<BR>

<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Ken Rune Helland [<A HREF="mailto:kenh@csc.no">mailto:kenh@csc.no</A>]</FONT>
<BR><FONT SIZE=2>Sent: Wednesday, January 02, 2002 5:34 PM</FONT>
<BR><FONT SIZE=2>To: ann_b15@hotmail.com</FONT>
<BR><FONT SIZE=2>Cc: jdom-interest@jdom.org</FONT>
<BR><FONT SIZE=2>Subject: Re: [jdom-interest] Problems with '&lt;' and '&gt;' in</FONT>
<BR><FONT SIZE=2>element.addContent()</FONT>
</P>
<BR>

<P><FONT SIZE=2>&gt; Hi</FONT>
<BR><FONT SIZE=2>&gt;</FONT>
<BR><FONT SIZE=2>&gt; I have a problem when I try to add content included the signs &quot;&lt;&quot;</FONT>
<BR><FONT SIZE=2>&gt; and &quot;&gt;&quot;to an element. I write:</FONT>
<BR><FONT SIZE=2>&gt; element.addContent(&quot;&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&quot;);</FONT>
</P>

<P><FONT SIZE=2>The characters '&lt;' and '&gt;' are xml characters and jdom asumes when these </FONT>
<BR><FONT SIZE=2>characters is in a child content that these characters is to be escaped as </FONT>
<BR><FONT SIZE=2>not to be read as xml characters ( '&amp;lt;' is the escape for '&lt;' and '&amp;gt;' </FONT>
<BR><FONT SIZE=2>for '&gt;').</FONT>
</P>

<P><FONT SIZE=2>To get what you need i jdom you must make a 'HTML' element and add a 'HEAD' </FONT>
<BR><FONT SIZE=2>element and a 'BODY' element as children to the 'HTML' element.</FONT>
</P>

<P><FONT SIZE=2>Content inside the body must then be added as children to the 'BODY' </FONT>
<BR><FONT SIZE=2>element.</FONT>
</P>

<P><FONT SIZE=2>example:</FONT>
</P>

<P><FONT SIZE=2>Element root = new Element(&quot;HTML&quot;);</FONT>
<BR><FONT SIZE=2>Document doc = new Document( root );</FONT>
</P>

<P><FONT SIZE=2>root.addContent(new Element(&quot;HEAD&quot;);</FONT>
</P>

<P><FONT SIZE=2>Element body = new Element(&quot;BODY&quot;); </FONT>
<BR><FONT SIZE=2>root addContent(body);</FONT>
</P>

<P><FONT SIZE=2>Element header1 = new Element(&quot;H1&quot;);</FONT>
<BR><FONT SIZE=2>body.addContent(header1);</FONT>
</P>

<P><FONT SIZE=2>header1.addContent(&quot;text 1&quot;);</FONT>
</P>

<P><FONT SIZE=2>body.addContent(&quot;text 2&quot;);</FONT>
</P>
<BR>

<P><FONT SIZE=2>When outputting this document you shoud get someting like</FONT>
</P>

<P><FONT SIZE=2>&lt;HTML&gt;</FONT>
<BR><FONT SIZE=2>&nbsp; &lt;HEAD/&gt;</FONT>
<BR><FONT SIZE=2>&nbsp; &lt;BODY&gt;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; &lt;H1&gt;text 1&lt;/H1&gt;</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp; text 2</FONT>
<BR><FONT SIZE=2>&nbsp; &lt;/BODY&gt;</FONT>
<BR><FONT SIZE=2>&lt;/HTML&gt;</FONT>
</P>
<BR>

<P><FONT SIZE=2>But im not certain JDOM is good for html as valid html is not nesesarily </FONT>
<BR><FONT SIZE=2>valid xml.</FONT>
</P>
<BR>

<P><FONT SIZE=2>KenR</FONT>
</P>
<BR>

<P><FONT SIZE=2>_______________________________________________</FONT>
<BR><FONT SIZE=2>To control your jdom-interest membership:</FONT>
<BR><FONT SIZE=2><A HREF="http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com" TARGET="_blank">http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com</A></FONT>
</P>

</BODY>
</HTML>