commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: [jelly]Using Jelly to output HTML content
Date Wed, 08 Jan 2003 07:03:02 GMT
From: "Kelly Chen" <>
>   I am investigating output HTML contents using Jelly. The quick
> experiment that I have done is taking a existing HTML page and wrap
> around its content with Jelly. For example:
> <?xml version="1.0" encoding="utf8"?>
> <j:jelly trim="false" xmlns:j="jelly:core" xmlns:x="jelly:xml"
> xmlns:html="jelly:html">
> .... HTML content
> </j:jelly>
> I ran into several XML parsing error in this test.
> 1. OK in HTML: <img src="./dot.gif" height="5" width="20">
> Error in XML, because <img> is not closed. There are several other tags
that are causing this problem like: <br>, <meta ... >, etc. To work around
this issue, I artificially close the tag. Browser seems still to be able to
understand this afterwards. For example, <br> becomes <br/>.
> 2. The second class of problems: some usage of HTML keyword break XML
parsing completely. For example:
> <td nowrap ...>

Jelly scripts are currently expected to be XML. So any XML compliant
document (such as XHTML) would do.

Though Jelly's XMLParser can use any SAX parser. So you could configure
Jelly's parser to use the NekoHTML parser which can parser any HTML and turn
it into SAX events. So it is possible you could use HTML and turn them into
Jelly scripts.

> For this case, I don't have a work around that can preserve the original
HTML and also makes Jelly parser happy.
> Question 1: Has anyone used Jelly to output a sophisticated HTML page? The
example in tutorial is way too simple. Suggestions on how to approach this
kind of issue are welcome.

You can use HTML output mode...

<j:file name="foo.html" outputMode="html">

This will turn any <br/> or <br></br> tags into just <br> to support
browsers etc.

You can do a similar thing using XSLT via the <x:transform> tag.

> Question 2: Does Jelly XML parser use any sort of DTD?

No. Though you can use any DTDs or XML Schemas in your XML file if you wish.


Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

View raw message