Hi Tjeerd, This was exactly what my clients wanted 4 projects ago. They wanted the field name, error type, etc information back and they wanted multiple validation exceptions to be returned all at once.
However, returning more than one validation exception at once is a preference. Others may like to have only one validation exception returned to them at a time. I was able to provide multiple validation functionality all the time into some prototype code but they later wanted to turn multiple validation on and off via a config file. I never found the time to parameterize the mutliple validation functionality into a config file. I never submitted the mutliple validation code for approval because I figured that the Castor folks would also want the ability to turn multiple validation on and off via a config file before even considering accepting the code. If I have some time between projects in late October, maybe I'll try to do a little more work to get the field name, error type stuff accepted by Castor before trying to tackle the multiple validation challenge. Regards, Joyce --- "Verhagen, Tjeerd" <[EMAIL PROTECTED]> wrote: > Hi Joyce, > > > that suggestion of you is indead very good in my > opinion! > It answears my 1st question. > > But what I also miss is, the validation of the hole > CastorBean. Now it returns when the 1st error is > found. > Where I would like, that it continues validating and > reporting all the errors at once. Not returning one > error and after the user corrects the 1st error, > returning the next error when doing the validation. > > > Thanks, Tjeerd > > > > -----Original Message----- > > From: Joyce Wong [mailto:[EMAIL PROTECTED]] > > Sent: 17 September 2002 23:15 > > To: [EMAIL PROTECTED] > > Subject: Re: [castor-dev] Validation questions > > > > > > Hey Tjeerd, > > > > Would this be of interest to you? > > > > > http://castor.exolab.org/list-archive/msg04221.html > > > > Regards, > > Joyce > > > > --- "Verhagen, Tjeerd" <[EMAIL PROTECTED]> > wrote: > > > All, > > > > > > > > > My project context: > > > For the project we use XML Schema and Castor to > > > generate the JavaBeans. The > > > web application is build on Struts. The (Castor) > > > JavaBeans are filled in a > > > (Struts) Action, through the use of > > > Commons-BeanUtils. After filling the > > > JavaBean we call the method validate(), to check > if > > > all the values are XML > > > Schema compliant. If succesfull the JavaBean can > be > > > made persistent. And if > > > the JavaBean is not correct filled, I would like > to > > > present the probles to > > > the user. > > > > > > Questions: > > > > > > 1 Field Name > > > When using the method validate() of a > generated > > > JavaBean, it only returns > > > > > > the name of the bean, not the name of the > field. > > > Like: > > > > > > ValidationException: strings of this type > must > > > have a maximum length of > > > 10; > > > - location of error: XPATH: operatingUnit > > > > > > In this case I know there is only one String > > > field with max size of 10, > > > but > > > in other cases there are several fields with > the > > > same resitrictions. > > > > > > What I hat expected (/liked) to see was > something > > > like: > > > 'location of error: XPATH: > operatingUnit.code' > > > > > > - Is it possible to extract the field name? > > > - Or can Castor be extended/updated to give > that > > > inforamtion? > > > > > > > > > 2 Composite Validation Exception > > > Is it possible to get more then one error > back > > > through a > > > ValidationException? > > > It would be nice to get all the problems > back, > > > that exist in the JavaBean > > > and not only the first one that is > discovered. > > > I'm thinking on a > > > Exception, that > > > can contain multiple exceptions (DP: > > > GOF.Composite). > > > > > > Or are there smart people that have already > > > solved this problem? > > > > > > When getting all the problems back (or a > number > > > which could be set > > > externaly), > > > they can be presented to the user at once. > And > > > not as now 1 by 1. > > > > > > > > > Thanks for your help! > > > > > > > > > Regards, Tjeerd > > > > > > > > > ---------- > > > <!-- OperatingUnit List --> > > > <xsd:element name="operatingUnitList"> > > > <xsd:complexType> > > > <xsd:sequence> > > > <xsd:element name="operatingUnit" > > > minOccurs="0" > > > maxOccurs="unbounded" type="operatingUnit_Type" > /> > > > </xsd:sequence> > > > </xsd:complexType> > > > </xsd:element> > > > > > > <!-- OperatingUnit Type --> > > > <xsd:complexType name="operatingUnit_Type"> > > > <xsd:sequence> > > > <xsd:element name="name"> > > > <xsd:simpleType> > > > <xsd:restriction base="xsd:string"> > > > <xsd:minLength value="0" /> > > > <xsd:maxLength value="80" /> > > > </xsd:restriction> > > > </xsd:simpleType> > > > </xsd:element> > > > <xsd:element name="code" > minOccurs="0"> > > > <xsd:simpleType> > > > <xsd:restriction base="xsd:string"> > > > <xsd:minLength value="0" /> > > > <xsd:maxLength value="10" /> > > > </xsd:restriction> > > > </xsd:simpleType> > > > </xsd:element> > > > > > > ... > > > > > > </xsd:complexType> > > > ---------- > > > > > > > > > Tjeerd Verhagen > > > Software Engineer > > > Energy & Utilities > > > > > > Logica BV > > > Zuiderdiep 22 > > > 9711 HG Groningen > > > The Netherlands > > > E-Mail: [EMAIL PROTECTED] > > > Tel: +31 (0) 50 588 5555 > > > Fax: +31 (0) 50 588 5500 > > > Tel: +31 (0) 10 206 1479 [Logica desk] > > > Fax: +31 (0) 10 206 1100 [near desk] > > > www.logica.com > > > > > > > > > > > > This e-mail and any attachment is for authorised > use > > > by the intended recipient(s) only. It may > contain > > > proprietary material, confidential information > > > and/or be subject to legal privilege. It should > not > > > be copied, disclosed to, retained or used by, > any > > > other party. If you are not an intended > recipient > > > then please promptly delete this e-mail and any > > > attachment and all copies and inform the sender. > > > > Thank you. > > > > === message truncated === ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
