You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by emerson cargnin <ec...@gmail.com> on 2006/06/22 11:23:34 UTC

Hook to validate XHTML

Does anyone know of any hook to validate if a JSP is XHTML compliant?

Is it possible for a pre-commit hook to go for the commit but even
then display a warning??

emerson

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Hook to validate XHTML

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 22, 2006, at 14:10, emerson cargnin wrote:

> On 22/06/06, Ryan Schmidt wrote:
>
>> On Jun 22, 2006, at 13:23, emerson cargnin wrote:
>>
>>> Does anyone know of any hook to validate if a JSP is XHTML  
>>> compliant?
>>
>> No, but somebody just posted a pre-commit hook that performs some
>> other validation on files. You can surely use it as a basis for an
>> XHTML checker:
>>
>> http://svn.haxx.se/users/archive-2006-06/0853.shtml
>>
>>
>>> Is it possible for a pre-commit hook to go for the commit but even
>>> then display a warning??
>>
>> If you mean: is it possible for a pre-commit hook to allow the commit
>> to proceed, yet output text to the user, then I don't think so. You
>> can only output text to the user from a pre-* hook if you also return
>> a non-zero status, and thereby prevent the action from taking place.
>
> The manual says:
> "If the program returns a non-zero exit value, the commit is aborted
> and the transaction is removed. If the hook program writes data to
> stderr, it will be marshalled back to the client."
>
> It's not clear if it would be possible to write to sterr and even then
> return a 0 exit value.
>
> thanks anyway.
> PS: that would be a nice to have feature...

Don't forget to use the "reply to all" feature of your email program  
when replying so that your reply also goes to the mailing list and  
not just to me.

I agree the wording in the manual could be clearer. That seems to be  
the gist of this message:

http://svn.haxx.se/dev/archive-2006-03/1256.shtml

But before replying to your initial mail I did try it out and was  
unable to get my output displayed by the client unless I exited the  
hook with a nonzero code. That seems to be the intended behavior.

There has been other discussion on the lists about this topic, and I  
believe the idea was that there is no communication channel between  
the client and server over which a message could be transmitted in  
the case of success, and adding it would be non-trivial. (There have  
also been requests to make hooks interactive, which is even less  
trivial.) It's also been called into question what the purpose would  
be of printing output in the case of success. If you must inform the  
user of something after every commit, you could do so in an email  
sent from the hook. Since you know the username you can presumably  
construct or look up their email address.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Hook to validate XHTML

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 22, 2006, at 13:23, emerson cargnin wrote:

> Does anyone know of any hook to validate if a JSP is XHTML compliant?

No, but somebody just posted a pre-commit hook that performs some  
other validation on files. You can surely use it as a basis for an  
XHTML checker:

http://svn.haxx.se/users/archive-2006-06/0853.shtml


> Is it possible for a pre-commit hook to go for the commit but even
> then display a warning??

If you mean: is it possible for a pre-commit hook to allow the commit  
to proceed, yet output text to the user, then I don't think so. You  
can only output text to the user from a pre-* hook if you also return  
a non-zero status, and thereby prevent the action from taking place.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Hook to validate XHTML (OT)

Posted by Andy Levy <an...@gmail.com>.
On 6/22/06, Ryan Schmidt <su...@ryandesign.com> wrote:
> On Jun 22, 2006, at 14:09, Andy Levy wrote:
>
> > On 6/22/06, emerson cargnin <ec...@gmail.com> wrote:
> >> Does anyone know of any hook to validate if a JSP is XHTML compliant?
> >
> > Wouldn't that depend upon the functions performed by the JSP and any
> > data they may output also generating XHTML?  The JSP file itself won't
> > ever be valid XHTML (I don't think), and the final page that the JSP
> > produces may or may not be valid XHTML, depending on many factors.
>
> If ASP is anything like PHP, which I believe it is, then you can
> write your code either way. You could write:
>
> <?php
> echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ';
> echo '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' .
> "\n";
> echo '<html><head><title></title></head><body>' . "\n";
> echo rand() . "\n";
> echo '</body></html>' . "\n";
> ?>
>
> which, while it generates XHTML-compliant code, is not itself  XHTML-
> compliant. But you could also write the equivalent:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html><head><title></title></head><body>
> <script language="php">
> echo rand() . "\n";
> </script>
> </body></html>
>
> which might, with a little tweaking, conceivably pass as XHTML-
> compliant.

The language in question is JSP, not ASP, but I see your point.

However, even if you do this, and your PHP/JSP/ASP comes through as
"valid", the actual output generated by the code and sent to the
browser isn't assured of being valid, unless you're doing something
like a CMS with end to end validation of everything pumped through it
at the time it's input..

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Hook to validate XHTML (OT)

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jun 22, 2006, at 14:09, Andy Levy wrote:

> On 6/22/06, emerson cargnin <ec...@gmail.com> wrote:
>> Does anyone know of any hook to validate if a JSP is XHTML compliant?
>
> Wouldn't that depend upon the functions performed by the JSP and any
> data they may output also generating XHTML?  The JSP file itself won't
> ever be valid XHTML (I don't think), and the final page that the JSP
> produces may or may not be valid XHTML, depending on many factors.

If ASP is anything like PHP, which I believe it is, then you can  
write your code either way. You could write:

<?php
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ';
echo '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' .  
"\n";
echo '<html><head><title></title></head><body>' . "\n";
echo rand() . "\n";
echo '</body></html>' . "\n";
?>

which, while it generates XHTML-compliant code, is not itself  XHTML- 
compliant. But you could also write the equivalent:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title></head><body>
<script language="php">
echo rand() . "\n";
</script>
</body></html>

which might, with a little tweaking, conceivably pass as XHTML- 
compliant.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Hook to validate XHTML

Posted by emerson cargnin <ec...@gmail.com>.
well, it looks that the jsp they commit are XHTML compliant, they use
http://validator.w3.org/ at the momment. So they ask me if I could
provide for a verification hook for that.

thanks

On 22/06/06, Andy Levy <an...@gmail.com> wrote:
> On 6/22/06, emerson cargnin <ec...@gmail.com> wrote:
> > Does anyone know of any hook to validate if a JSP is XHTML compliant?
>
> Wouldn't that depend upon the functions performed by the JSP and any
> data they may output also generating XHTML?  The JSP file itself won't
> ever be valid XHTML (I don't think), and the final page that the JSP
> produces may or may not be valid XHTML, depending on many factors.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Hook to validate XHTML

Posted by Andy Levy <an...@gmail.com>.
On 6/22/06, emerson cargnin <ec...@gmail.com> wrote:
> Does anyone know of any hook to validate if a JSP is XHTML compliant?

Wouldn't that depend upon the functions performed by the JSP and any
data they may output also generating XHTML?  The JSP file itself won't
ever be valid XHTML (I don't think), and the final page that the JSP
produces may or may not be valid XHTML, depending on many factors.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Hook to validate XHTML

Posted by Vincent Lefevre <vi...@vinc17.org>.
On 2006-06-22 12:23:34 +0100, emerson cargnin wrote:
> Is it possible for a pre-commit hook to go for the commit but even
> then display a warning??

No, and it seems that this won't change. :( Please look at the thread:

  http://svn.haxx.se/dev/archive-2006-03/0090.shtml

"data written to stderr in pre-commit hook is not output by the client"

-- 
Vincent Lefèvre <vi...@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: Hook to validate XHTML

Posted by ja...@subversus.org.
I actually did an XML validation in a hook at one point (or at least played
with it and got it working).  Essentially, I used a perl module (I don't
recall which one at the moment), and then compiled that using Perl PAR so
that it would run on windows without a wrapper.

If you'd like I could attempt to find it at home and send it your way (of
course, you would either need Perl and the appropriate modules installed, or
be running Windows so I could send you the executable).


-----Original Message-----
From: emerson cargnin [mailto:echofloripa.yell@gmail.com] 
Sent: Thursday, June 22, 2006 7:24 AM
To: users@subversion.tigris.org
Subject: Hook to validate XHTML

Does anyone know of any hook to validate if a JSP is XHTML compliant?

Is it possible for a pre-commit hook to go for the commit but even
then display a warning??

emerson

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org