Hi,

There is documentation and some examples right in the documentation on how to do
what you want, which is XHTML, that is, HTML that is valid XML.

See the doco here:

    org.dom4j.io.HTMLWriter

there is code in there specifically to deal with comments inside script tags, and
preformatted sections.  There is also stuff for adding other tags to the list of
things that are considered preformatted.  For that you would use
HTMLWriter.setPreformattedTags(...).


Thanks,
Laramie Crocker


--- [EMAIL PROTECTED] wrote:
> Bugs item #616561, was opened at 2002-09-30 09:20
> You can respond by visiting: 
> https://sourceforge.net/tracker/?func=detail&atid=116035&aid=616561&group_id=16035
> 
> Category: None
> Group: None
> Status: Open
> Resolution: None
> Priority: 5
> Submitted By: Robert O'Connell (roconnellj)
> Assigned to: Nobody/Anonymous (nobody)
> Summary: XMLResult/HTMLWriter output cut short
> 
> Initial Comment:
> I am trying to use the XMLResult in conjunction with an 
> HTMLWriter in order to achieve prettyPrinted output of 
> an HTML document that is the result of a transform.
> 
> However, I am encountering two difficulties with this 
> process.
> 
> I am using dom4j 1.3, and jdk 1.3.1_04 or 1.4.0_2 on a 
> windows 2000 environment. (Although the same results 
> appear with 9/30/02's daily dom4j also.)
> 
> 1) The output is being cut short in the middle of a 
> <script> tag (the last one?).
> 2) The script tags are not being output with preformatted 
> type. Instead, all CRs are being stripped.
> 
> I have put together a simple test-bed java class and 
> input XML and XSL that has similar results to my real 
> world case (included in the uploaded zip file).
> Using the attached files here are my results.
> 
> Non-"Pretty" output (Result is simply a StreamResult. 
> Tags are not indented- but valid HTML):
> java -cp .;../dom4j.jar BugTest data.xml test.xsl
> <html>
> <head>
> <META http-equiv="Content-Type" content="text/html; 
> charset=UTF-8">
> <script>
>     /*
>         Testing first
>     */
> 
>     /*
>         Testing second
>     */
>   </script>
> </head>
> <body>
> <input id="first"><input id="second"><script>
>       /*
>         Testing first
>       */
>     </script><script>
>       /*
>         Testing second
>       */
>     </script>
> </body>
> </html>
> 
> Attempt at pretty printed output (Result is a XMLResult 
> on a HTMLWriter with pretty output. Truncated, invalid 
> HTML result) (pretty print option is driven by command 
> line parameter -p appearing before files):
> java -cp .;../dom4j.jar BugTest -p data.xml test.xsl
> <html>
>   <head>
>     <script>/* Testing first */ /* Testing second */</script>
>   </head>
>   <body>
>     <input id="first">
> 
>     <input id="second">
> 
>     <script>/* Testing first */</script>
>     <script>/* Testing second */
> 
> 
> Main difference between working and non-working cases:
> if (usePrettyPrint){
>     HTMLWriter htmlWriter = new HTMLWriter(out, 
> OutputFormat.createPrettyPrint());
>     result = new XMLResult(htmlWriter);
> }
> else{
>     result = new StreamResult(out);
> }
> 
> 
> Am I just using the API incorrectly, or is there a bug in 
> the underlying XMLResult or HTMLWriter classes?
> 
> 
> Thanks for any help,
> Rob
> 
> ----------------------------------------------------------------------
> 
> You can respond by visiting: 
> https://sourceforge.net/tracker/?func=detail&atid=116035&aid=616561&group_id=16035
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> dom4j-dev mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-dev


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to