You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by hese <10...@gmail.com> on 2010/11/09 23:08:04 UTC

how to make tapestry ignore some html tags while parsing tml file


Hi,

I am using html templates in my TML file...something like the below, to be
used with jQuery and other libraries to dynamically fill values easily.

<script id="AgencySlugTemplate" type="text/html">
...
...
<tr>
  <td id="t2Col1Text"><#= data.yesterday.totalImpressions #></td>
</tr>

</script>

note the '#' in the html, which is parsed by a JS function and replaced with
actual values.

but when the tml loads tapestry is throwing an error

Unexpected character '#' (code 38) in content after '<' (malformed start
element?).
 at [row,col {unknown-source}]: [43,30]

I also tried &#35; instead of # to see if it is escaped.  but the same
error.

Does anyone know a way to tell tapestry to ignore certain parts of the tml
file and not to parse them?

Thanks


-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-make-tapestry-ignore-some-html-tags-while-parsing-tml-file-tp3257771p3257771.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: how to make tapestry ignore some html tags while parsing tml file

Posted by Paul Stanton <pa...@mapshed.com.au>.
the only way i know of is to comment it out

<!--
-->

which will probably still cause you problems...

p.

On 10/11/2010 9:08 AM, hese wrote:
>
> Hi,
>
> I am using html templates in my TML file...something like the below, to be
> used with jQuery and other libraries to dynamically fill values easily.
>
> <script id="AgencySlugTemplate" type="text/html">
> ...
> ...
> <tr>
>    <td id="t2Col1Text"><#= data.yesterday.totalImpressions #></td>
> </tr>
>
> </script>
>
> note the '#' in the html, which is parsed by a JS function and replaced with
> actual values.
>
> but when the tml loads tapestry is throwing an error
>
> Unexpected character '#' (code 38) in content after '<' (malformed start
> element?).
>   at [row,col {unknown-source}]: [43,30]
>
> I also tried&#35; instead of # to see if it is escaped.  but the same
> error.
>
> Does anyone know a way to tell tapestry to ignore certain parts of the tml
> file and not to parse them?
>
> Thanks
>
>

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


Re: how to make tapestry ignore some html tags while parsing tml file

Posted by Everton Agner <to...@gmail.com>.
Does <![CDATA[ ... ]]> works?

_______________________
Everton Agner Ramos


2010/11/10 hese <10...@gmail.com>

>
> Thanks for all your replies!
>
> Fernando, I like your solution.  I was thinking on similar lines...but not
> as a component, but a function that would return  the "<#=" tags which i
> could 'outputraw' into the tml, like
>
> <tr>
> <td id="t2Col1Text">
> <t:outputraw ${beginTag}/>data.yesterday.totalImpressions<t:outputraw
> $endTag}>
> </td>
> </tr>
>
> and have two functions
>
> String getBeginTag() {
>   return "<#=";
> }
>
>
> String getEndTag() {
>   return "#>";
> }
>
> but was wondering if there is a short cut to do it :)
>
> Thanks!
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/how-to-make-tapestry-ignore-some-html-tags-while-parsing-tml-file-tp3257771p3258819.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: how to make tapestry ignore some html tags while parsing tml file

Posted by hese <10...@gmail.com>.
Thanks for all your replies!

Fernando, I like your solution.  I was thinking on similar lines...but not
as a component, but a function that would return  the "<#=" tags which i
could 'outputraw' into the tml, like

<tr>
<td id="t2Col1Text">
<t:outputraw ${beginTag}/>data.yesterday.totalImpressions<t:outputraw
$endTag}>
</td>
</tr>

and have two functions

String getBeginTag() {
   return "<#=";
}


String getEndTag() {
   return "#>";
}

but was wondering if there is a short cut to do it :)

Thanks!



-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/how-to-make-tapestry-ignore-some-html-tags-while-parsing-tml-file-tp3257771p3258819.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: how to make tapestry ignore some html tags while parsing tml file

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 09 Nov 2010 21:53:07 -0200, Fernando Padilla <fe...@alum.mit.edu>  
wrote:

> I would create my own component that would output the "<#= " " #>" text  
> around it's body:
>
> void beginRender( MarkupWriter writer ) {writer.raw("<#= ");}
> void afterRender( MarkupWriter writer ) {writer.raw(" #>");}
>
> then you can use that component anywhere in your templates
>
> <tr>
> <td id="t2Col1Text"><t:esc>data.yesterday.totalImpressions</t:esc></td>
> </tr>

Amazing approach, Fernando! :)

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: how to make tapestry ignore some html tags while parsing tml file

Posted by Fernando Padilla <fe...@alum.mit.edu>.
I would create my own component that would output the "<#= " " #>" text 
around it's body:

void beginRender( MarkupWriter writer ) {writer.raw("<#= ");}
void afterRender( MarkupWriter writer ) {writer.raw(" #>");}



then you can use that component anywhere in your templates

<tr>
<td id="t2Col1Text"><t:esc>data.yesterday.totalImpressions</t:esc></td>
</tr>



On 11/9/10 3:19 PM, Thiago H. de Paula Figueiredo wrote:
> On Tue, 09 Nov 2010 20:08:04 -0200, hese <10...@gmail.com> wrote:
>
>> Hi,
>
> Hi!
>
>> I am using html templates in my TML file...something like the below, 
>> to be used with jQuery and other libraries to dynamically fill values 
>> easily.
>> <tr>
>> <td id="t2Col1Text"><#= data.yesterday.totalImpressions #></td>
>> </tr>
>
> Tapestry templates must be well-formed XML and it's parsed by an XML 
> parser, so you need to find another solution. Maybe you'll need to use 
> the OutputRaw component.
>
> By the way, using <#= inside HTML seems very, very hacky to my taste.
>

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


Re: how to make tapestry ignore some html tags while parsing tml file

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 09 Nov 2010 20:08:04 -0200, hese <10...@gmail.com> wrote:

> Hi,

Hi!

> I am using html templates in my TML file...something like the below, to  
> be used with jQuery and other libraries to dynamically fill values  
> easily.
> <tr>
>   <td id="t2Col1Text"><#= data.yesterday.totalImpressions #></td>
> </tr>

Tapestry templates must be well-formed XML and it's parsed by an XML  
parser, so you need to find another solution. Maybe you'll need to use the  
OutputRaw component.

By the way, using <#= inside HTML seems very, very hacky to my taste.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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