You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Steven Coco <co...@stevencoco.com> on 2007/06/09 02:51:09 UTC

Hackish(?) Workaround for Entities In Templates

I just implemented a set of properties in WEB-INF/Application.properties. They 
look like this:

# HTML entities:
entity.copy: &copy;
entity.trade: &trade;
...

Now in templates I can "use" them like so:

<t:OutputRaw value="message:entity.trade"/>

Such is life.

Ciao.
-Steven Coco.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Hackish(?) Workaround for Entities In Templates

Posted by Steven Coco <co...@stevencoco.com>.
Hi.

This thread is  bit old, but I've just gotten back on to this.

I implemented the mapping you showed here, and it works enough to allow Tap to 
serve the doctype to the user, and not raise any exceptions. But the entities 
still don't work. In fact, character references don't work either: character 
refs are the numerical forms &#x2122; and such.

So for now I've just added the contribution, and the doctype in the template, 
and I'm still using the entities from my own message bundle as I mentioned. 
This does actually form a complete solution for now, to what I am trying to 
serve (I get the right doctype, and can use entities).

Thanks for the help.

Steev Coco.


On Sun June 10 2007 7:10:14 pm Robert Zeigler wrote:
> Ok, this is a touch hackish, but... you can map the HTML definitions
> to their corresponding xml definitions.  It's hackish because, a)
> it's contributing to an "internal" service, and b) You'll still have
> to write valid xml templates.  But you'll be able to use the 4.01
> DTD, and that is the DTD which will be passed on to the client.
> Anyway, the appropriate contribution looks like:
>
>      public static void contributeTemplateParser
> (MappedConfiguration<String, URL> map)
>      {
>          Class<InternalModule> c = InternalModule.class;
>          map.add("-//W3C//DTD HTML 4.01 Transitional//
> EN",c.getResource("xhtml1-transitional.dtd"));
>          map.add("-//W3C//DTD HTML 4.01//EN",c.getResource("xhtml1-
> strict.dtd"));
>          map.add("-//W3C//DTD HTML 4.01 Frameset//EN",c.getResource
> ("xhtml1-frameset.dtd"));
>      }
>
>
> Robert
>
> On Jun 10, 2007, at 6/103:36 PM , Steven Coco wrote:
> > It's most definitely hackish!!! I'm considering it completely
> > temporary.
> >
> > But, I can't currently specify HTML 4 strict: Tapestry runs the XML
> > DTD parser
> > which errors on that DTD. I want to use this DTD (not XHTML).
> >
> > Actually I just stumbled over the UTF-8 encoding entry in the Wiki,
> > so that is
> > another concept, but my current plan revolved around entities and
> > HTML 4
> > strict; and I haven't come far enough to understand Tap and client
> > accept-encodings. I'll work it out in time: and probably by then
> > DTD support
> > will be implemented up a notch...
> >
> > Thanks for the help.
> >
> > -Steven Coco.
> >
> > On Sat June 9 2007 6:08:44 pm D&J Gredler wrote:
> >> If you specify a doctype in your templates (like XHTML 1.0
> >> Strict), you can
> >> use entities like &copy;
> >>
> >>
> >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
> >> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> >>
> >> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="
> >> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
> >>     Copyright &copy; Me
> >> </html>
> >>
> >> On 6/8/07, Steven Coco <co...@stevencoco.com> wrote:
> >>> I just implemented a set of properties in WEB-INF/
> >>> Application.properties.
> >>> They
> >>> look like this:
> >>>
> >>> # HTML entities:
> >>> entity.copy: &copy;
> >>> entity.trade: &trade;
> >>> ...
> >>>
> >>> Now in templates I can "use" them like so:
> >>>
> >>> <t:OutputRaw value="message:entity.trade"/>
> >>>
> >>> Such is life.
> >>>
> >>> Ciao.
> >>> -Steven Coco.
> >>>
> >>> --------------------------------------------------------------------
> >>> -
> >>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>> For additional commands, e-mail: users-help@tapestry.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Hackish(?) Workaround for Entities In Templates

Posted by Robert Zeigler <ro...@scazdl.org>.
Ok, this is a touch hackish, but... you can map the HTML definitions  
to their corresponding xml definitions.  It's hackish because, a)  
it's contributing to an "internal" service, and b) You'll still have  
to write valid xml templates.  But you'll be able to use the 4.01  
DTD, and that is the DTD which will be passed on to the client.   
Anyway, the appropriate contribution looks like:

     public static void contributeTemplateParser 
(MappedConfiguration<String, URL> map)
     {
         Class<InternalModule> c = InternalModule.class;
         map.add("-//W3C//DTD HTML 4.01 Transitional// 
EN",c.getResource("xhtml1-transitional.dtd"));
         map.add("-//W3C//DTD HTML 4.01//EN",c.getResource("xhtml1- 
strict.dtd"));
         map.add("-//W3C//DTD HTML 4.01 Frameset//EN",c.getResource 
("xhtml1-frameset.dtd"));
     }


Robert

On Jun 10, 2007, at 6/103:36 PM , Steven Coco wrote:

> It's most definitely hackish!!! I'm considering it completely  
> temporary.
>
> But, I can't currently specify HTML 4 strict: Tapestry runs the XML  
> DTD parser
> which errors on that DTD. I want to use this DTD (not XHTML).
>
> Actually I just stumbled over the UTF-8 encoding entry in the Wiki,  
> so that is
> another concept, but my current plan revolved around entities and  
> HTML 4
> strict; and I haven't come far enough to understand Tap and client
> accept-encodings. I'll work it out in time: and probably by then  
> DTD support
> will be implemented up a notch...
>
> Thanks for the help.
>
> -Steven Coco.
>
>
> On Sat June 9 2007 6:08:44 pm D&J Gredler wrote:
>> If you specify a doctype in your templates (like XHTML 1.0  
>> Strict), you can
>> use entities like &copy;
>>
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>>
>> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="
>> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>>     Copyright &copy; Me
>> </html>
>>
>> On 6/8/07, Steven Coco <co...@stevencoco.com> wrote:
>>> I just implemented a set of properties in WEB-INF/ 
>>> Application.properties.
>>> They
>>> look like this:
>>>
>>> # HTML entities:
>>> entity.copy: &copy;
>>> entity.trade: &trade;
>>> ...
>>>
>>> Now in templates I can "use" them like so:
>>>
>>> <t:OutputRaw value="message:entity.trade"/>
>>>
>>> Such is life.
>>>
>>> Ciao.
>>> -Steven Coco.
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Hackish(?) Workaround for Entities In Templates

Posted by Steven Coco <co...@stevencoco.com>.
It's most definitely hackish!!! I'm considering it completely temporary.

But, I can't currently specify HTML 4 strict: Tapestry runs the XML DTD parser 
which errors on that DTD. I want to use this DTD (not XHTML).

Actually I just stumbled over the UTF-8 encoding entry in the Wiki, so that is 
another concept, but my current plan revolved around entities and HTML 4 
strict; and I haven't come far enough to understand Tap and client 
accept-encodings. I'll work it out in time: and probably by then DTD support 
will be implemented up a notch...

Thanks for the help.

-Steven Coco.


On Sat June 9 2007 6:08:44 pm D&J Gredler wrote:
> If you specify a doctype in your templates (like XHTML 1.0 Strict), you can
> use entities like &copy;
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="
> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>     Copyright &copy; Me
> </html>
>
> On 6/8/07, Steven Coco <co...@stevencoco.com> wrote:
> > I just implemented a set of properties in WEB-INF/Application.properties.
> > They
> > look like this:
> >
> > # HTML entities:
> > entity.copy: &copy;
> > entity.trade: &trade;
> > ...
> >
> > Now in templates I can "use" them like so:
> >
> > <t:OutputRaw value="message:entity.trade"/>
> >
> > Such is life.
> >
> > Ciao.
> > -Steven Coco.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Hackish(?) Workaround for Entities In Templates

Posted by D&J Gredler <dj...@gmail.com>.
If you specify a doctype in your templates (like XHTML 1.0 Strict), you can
use entities like &copy;


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="
http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
    Copyright &copy; Me
</html>


On 6/8/07, Steven Coco <co...@stevencoco.com> wrote:
>
> I just implemented a set of properties in WEB-INF/Application.properties.
> They
> look like this:
>
> # HTML entities:
> entity.copy: &copy;
> entity.trade: &trade;
> ...
>
> Now in templates I can "use" them like so:
>
> <t:OutputRaw value="message:entity.trade"/>
>
> Such is life.
>
> Ciao.
> -Steven Coco.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Daniel Gredler
http://daniel.gredler.net/