You could probably do this, if you felt so inclined.
You can't override SaxTemplateParser directly.  Instead, you would override 
TemplateParser (contributed by InternalModule), and use that to instantiate 
your custom/overridden SaxTemplateParser.
One clarification: template /parsing/ is different from template /rendering/.  
Parsing parses the static structure of the page and components.  That should be 
done only once per page.  /Rendering/ is done every request.
So using MarkupRendererFilter, the comment removal happens each time.  Using 
the template parser, the comments never make it into the final rendered page.  
BUT.  Using MarkupRendererFilter doesn't involve any internal service monkeying 
and will be much less bug prone/easier to implement.  Plus, the template parser 
approach will only remove comments that are hard-coded into the template files. 
 If someone dynamically adds a comment, you'll miss that.

In general, I would advise going the MarkupRendererFilter route.  I think 
you'll find it much more convenient and flexible.

Robert

On Mar 10, 2011, at 3/104:39 AM , stephanos2k wrote:

> Would it make more sense (performance-wise) to remove the HTML comments in
> the 'SaxTemplateParser'?
> 
> I remembered that there was an option in Tapestry to compress whitespaces
> from templates. I dug around the Tapestry source a bit and found the
> 'SaxTemplateParser' which apparently parses each template once before
> 'using' it for each request (correct me if I'm wrong). 
> 
> What do you think?
> Can I override the parser somehow?
> 
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/remove-HTML-comments-from-output-tp3415110p3423090.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 


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

Reply via email to