commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mart...@apache.org>
Subject Re: [jelly]Using Jelly to output HTML content
Date Tue, 07 Jan 2003 19:59:48 GMT


On Tue, 7 Jan 2003, Kelly Chen wrote:

>   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/>.

Most (modern) browsers will accept XHTML as well as plain old HTML. In
XHTML, what you are doing in closing the tag is correct. Some people
suggest using a space before the / because it apparently keeps some
browsers happy that wouldn't be otherwise. (In other words, use <hr />
instead of just <hr/>.)

>
> 2. The second class of problems: some usage of HTML keyword break XML parsing completely.
For example:
> <td nowrap ...>
>
> For this case, I don't have a work around that can preserve the original HTML and also
makes Jelly parser happy.

Since XML doesn't support attribute minimisation, you have to use the
XHTML solution for this, which is <td nowrap="nowrap" ...>. You use the
name of the attribute as the value of the attribute. (So, for a multiple
select, you would use <select multiple="multiple" ...>.)

--
Martin Cooper


>
> 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.
>
> Question 2: Does Jelly XML parser use any sort of DTD?
>
> Thanks.
> --
> Kelly Chen                       Tumbleweed Communication Corp.
> T:650-216-2043                   700 Saginaw Drive
> F:650-216-2565                   Redwood City, CA 94063
>
>
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-user-help@jakarta.apache.org>
>
>


Mime
View raw message