You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Greg Ward <gw...@python.net> on 2005/08/09 20:28:22 UTC

Validating templates

I'd like to be able to validate my Tapestry templates, e.g. by running
xmllint or nsgmls as part of our nightly build.  (Our pages are all
strict XHTML 1.0.)  But of course, Tapestry adds elements that aren't in
the XHTML DTDs:

  $ xmllint --noout --valid webapp/WEB-INF/Login.html
  webapp/WEB-INF/Login.html:4: element html: validity error : No declaration for attribute jwcid of element html
  ognl:doctype" stylesheets="ognl:stylesheets" delegate="ognl:beans.shellDelegate"
  [...]
  webapp/WEB-INF/Login.html:19: element span: validity error : No declaration for attribute jwcid of element span
        <span jwcid="@Insert" value="ognl:error"/>
                                                ^
  webapp/WEB-INF/Login.html:19: element span: validity error : No declaration for attribute value of element span
        <span jwcid="@Insert" value="ognl:error"/>
                                                ^
...etc, etc.

I suppose one possibility is to doctor the XHTML DTDs to know about
Tapestry's dialect of HTML and then use the doctored copy for validation
(blecch).  Has anyone done this?  Is there a better way?

        Greg


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


Re: Validating templates

Posted by Geoff Longman <gl...@gmail.com>.
> What would be nice is if the core of Spindle could be used within a
> custom Ant task to do the full check of a Tapestry project, though I
> realize that is probably difficult to achieve because of it is so
> intertwined with Eclipse.
> 
>      Erik


Yes, that would be a trick wouldn't it.

Geoff

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


Re: Validating templates

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Aug 9, 2005, at 4:46 PM, Greg Ward wrote:
> On 09 August 2005, Howard Lewis Ship said:
>
>> So if it is DROP DEAD important for you to validate that your
>> templates are valid, you can do that. But you'll do a bit more work.
>>
>
> No, it's more of "I'm going on vacation for a week tomorrow, so I  
> might
> as well not start anything important" thing.  ;-)  Plus, I finally
> learned enough about XML and xmllint to validate .page files from the
> command-line that I figured I might as well do templates as well.

How about using <xmlvalidate> from your Ant build process?  I  
generally put that into my builds so I know when things break at  
build-time rather than deploy-time.

>> I think it might be better to validate that your output PAGES are  
>> valid.
>>
>
> Yeah, that's definitely the more interesting problem.  Can't do it in
> the nightly build, though, alas.

What would be nice is if the core of Spindle could be used within a  
custom Ant task to do the full check of a Tapestry project, though I  
realize that is probably difficult to achieve because of it is so  
intertwined with Eclipse.

     Erik


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


Re: Validating templates

Posted by Greg Ward <gw...@python.net>.
On 09 August 2005, Howard Lewis Ship said:
> So if it is DROP DEAD important for you to validate that your
> templates are valid, you can do that. But you'll do a bit more work.

No, it's more of "I'm going on vacation for a week tomorrow, so I might
as well not start anything important" thing.  ;-)  Plus, I finally
learned enough about XML and xmllint to validate .page files from the
command-line that I figured I might as well do templates as well.  Not
so simple, of course.

> I think it might be better to validate that your output PAGES are valid.

Yeah, that's definitely the more interesting problem.  Can't do it in
the nightly build, though, alas.

        Greg

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


Re: Validating templates

Posted by Howard Lewis Ship <hl...@gmail.com>.
It is possible, in Tapestry 4.0, to control what attribute is used to
identify components (the default is "jwcid"), so you can make it be
simply "id".

However, there's not much you can do with all the "extra" attributes
.. the attribute that are really Tapestry component parameter
bindings.  Those have to go somewhere, but not necessarily in the
(X)HTML template.

- They can go in a companion XML specification (a .page or .jwc file)
- They can be represented using the @Component annotation inside the
corresponding Java class.

So if it is DROP DEAD important for you to validate that your
templates are valid, you can do that. But you'll do a bit more work.

I think it might be better to validate that your output PAGES are valid.

On 8/9/05, Greg Ward <gw...@python.net> wrote:
> I'd like to be able to validate my Tapestry templates, e.g. by running
> xmllint or nsgmls as part of our nightly build.  (Our pages are all
> strict XHTML 1.0.)  But of course, Tapestry adds elements that aren't in
> the XHTML DTDs:
> 
>   $ xmllint --noout --valid webapp/WEB-INF/Login.html
>   webapp/WEB-INF/Login.html:4: element html: validity error : No declaration for attribute jwcid of element html
>   ognl:doctype" stylesheets="ognl:stylesheets" delegate="ognl:beans.shellDelegate"
>   [...]
>   webapp/WEB-INF/Login.html:19: element span: validity error : No declaration for attribute jwcid of element span
>         <span jwcid="@Insert" value="ognl:error"/>
>                                                 ^
>   webapp/WEB-INF/Login.html:19: element span: validity error : No declaration for attribute value of element span
>         <span jwcid="@Insert" value="ognl:error"/>
>                                                 ^
> ...etc, etc.
> 
> I suppose one possibility is to doctor the XHTML DTDs to know about
> Tapestry's dialect of HTML and then use the doctored copy for validation
> (blecch).  Has anyone done this?  Is there a better way?
> 
>         Greg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

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


Re: Validating templates

Posted by Paul Cantrell <ca...@pobox.com>.
Another possibility would be to write some XSLT that strips the  
offending attributes, and possibly removes <span> tags that Tapestry  
would delete anyway. That would bit easier to construct, and be a bit  
more maintainable, than a doctored DTD. It would even let you  
generate mockup for components than insert their own tags (e.g.  
Table), if you really want to go buck wild.

Just an idea.

Cheers,

Paul

On Aug 9, 2005, at 1:28 PM, Greg Ward wrote:

> I'd like to be able to validate my Tapestry templates, e.g. by running
> xmllint or nsgmls as part of our nightly build.  (Our pages are all
> strict XHTML 1.0.)  But of course, Tapestry adds elements that  
> aren't in
> the XHTML DTDs:
>
>   $ xmllint --noout --valid webapp/WEB-INF/Login.html
>   webapp/WEB-INF/Login.html:4: element html: validity error : No  
> declaration for attribute jwcid of element html
>   ognl:doctype" stylesheets="ognl:stylesheets"  
> delegate="ognl:beans.shellDelegate"
>   [...]
>   webapp/WEB-INF/Login.html:19: element span: validity error : No  
> declaration for attribute jwcid of element span
>         <span jwcid="@Insert" value="ognl:error"/>
>                                                 ^
>   webapp/WEB-INF/Login.html:19: element span: validity error : No  
> declaration for attribute value of element span
>         <span jwcid="@Insert" value="ognl:error"/>
>                                                 ^
> ...etc, etc.
>
> I suppose one possibility is to doctor the XHTML DTDs to know about
> Tapestry's dialect of HTML and then use the doctored copy for  
> validation
> (blecch).  Has anyone done this?  Is there a better way?
>
>         Greg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>

_________________________________________________________________

"Verbing weirds language."  -- Bill Watterson


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