You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Marco Tedone <mt...@jemos.co.uk> on 2006/04/26 22:39:26 UTC

[jelly] About Tag data validation

May I suggest to add the method:

public void validate(XMLOutput output) throws JellyTagException to the Tag 
interface? I'm writing some tags, and I realize that for the quite totality 
of them I need to validate some data (like the attributes). It would be nice 
if the Tag interface defined such method which could be implemented by 
TagSupport without doing actually any behaviour, and then concrete Tags 
could override the method providing a custom implementation.

Marco 


---
[This E-mail has been scanned for viruses but it is your responsibility 
to maintain up to date anti virus software on the device that you are
currently using to read this email. ]


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


Re: [jelly] About Tag data validation

Posted by Marco Tedone <mt...@jemos.co.uk>.
I do see the reason of having such method in the Tag class. Validation is a 
common activity to perform from within a concrete Tag. By inserting a 
validate() method in the Tag interface, you would tell your clients: 'Ok, I 
thought about validation' and having a validate() method available instead 
of having to write one for every single Tag would make (at least mine) life 
easier. But it's not my needs we are discussing here, rather the community's 
ones.

As regards exceptions, I believe that having JellyException as a 
SAXException, provided that SAX is in the long run the way Jelly wants to 
go, it's a good idea.

My 2 cents
----- Original Message ----- 
From: "Paul Libbrecht" <pa...@activemath.org>
To: "Jakarta Commons Users List" <co...@jakarta.apache.org>
Sent: Thursday, April 27, 2006 9:42 AM
Subject: Re: [jelly] About Tag data validation


>
> Except for the change of exception type (JellyTagException vs 
> SAXException), I see no real reason to have such instead of inserting this 
> validation within doTag.
> Do you see one Marco ?
>
> As for the exception types, we could maybe ease up propagation with 
> JellyException.asSAXException() (for use within doTag) and new 
> JellyException(SAXException) (for use in others, which would undress a 
> wrapped jelly-exception). Indeed, these long wraps of exceptions as dumped 
> to console sometimes, e.g. by maven, are quite ugly.
> An alternative would be to have JellyException be a SAXException... not 
> sure it's a good idea but it would ease up things.
>
> paul
>
> Marco Tedone wrote:
>> May I suggest to add the method:
>>
>> public void validate(XMLOutput output) throws JellyTagException to the 
>> Tag interface? I'm writing some tags, and I realize that for the quite 
>> totality of them I need to validate some data (like the attributes). It 
>> would be nice if the Tag interface defined such method which could be 
>> implemented by TagSupport without doing actually any behaviour, and then 
>> concrete Tags could override the method providing a custom 
>> implementation.
>>
>> Marco
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
> 


---
[This E-mail has been scanned for viruses but it is your responsibility 
to maintain up to date anti virus software on the device that you are
currently using to read this email. ]


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


Re: [jelly] About Tag data validation

Posted by Paul Libbrecht <pa...@activemath.org>.
Except for the change of exception type (JellyTagException vs 
SAXException), I see no real reason to have such instead of inserting 
this validation within doTag.
Do you see one Marco ?

As for the exception types, we could maybe ease up propagation with 
JellyException.asSAXException() (for use within doTag) and new 
JellyException(SAXException) (for use in others, which would undress a 
wrapped jelly-exception). Indeed, these long wraps of exceptions as 
dumped to console sometimes, e.g. by maven, are quite ugly.
An alternative would be to have JellyException be a SAXException... not 
sure it's a good idea but it would ease up things.

paul

Marco Tedone wrote:
> May I suggest to add the method:
>
> public void validate(XMLOutput output) throws JellyTagException to the 
> Tag interface? I'm writing some tags, and I realize that for the quite 
> totality of them I need to validate some data (like the attributes). 
> It would be nice if the Tag interface defined such method which could 
> be implemented by TagSupport without doing actually any behaviour, and 
> then concrete Tags could override the method providing a custom 
> implementation.
>
> Marco
>


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