commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Graham <grahamdavid1...@yahoo.com>
Subject Re: [validator] validator dtd or schema
Date Wed, 10 Sep 2003 21:51:36 GMT
--- Qin Ding <qding@csc.com> wrote:
> 
> Thank you, David, for your quick response.
> 
> I believe that after the following code, the java objects (Formset,
> Form,
> Fields etc) are all populated with the data from validation.xml.  Is it
> true?

Yes.

> 
>          InputStream input = null;
>         BufferedInputStream bis = null;
> 
>         input = getClass().getResourceAsStream(Constants.CONFIG_DIR +
> validatorRules);  //validation.xml
>         if (input != null){
>           bis = new BufferedInputStream(input);
>           try{
>             ValidatorResourcesInitializer.initialize(validatorResources,
> bis);
>           }catch(Exception e){
>             e.printStackTrace();
>           }
>         }
>       }
> 
>       resources.process();
> 
>       //From this point on, I should be able to get the Formset
> -->getForm
> --> getField --> getProperty() and getDepends()
>      // Manipulated the data and then put the data into VelocityContext;
> 
> If so, I don't need to generate the java objects again.  All I need is
> to
> get the data out from the Formset, Form, and Fields objects.  Can you
> tell
> me from validatorResources object or something else, how can I get the
> formset object?  I don't see the method getFormset().  From Formset, I
> think I can get the fields and their requirements out.   If I have the
> following simple validation.xml,
> 
> <formset>
>     <form name="Aftermarket">
>       <field property="prdCd" depends="required,mask">
>         <var>
>           <var-name>mask</var-name>
>           <var-value>[a-zA-Z0-9]*</var-value>
>         </var>
>       </field>
>       <field property="dsc" depends="required">
>       </field>
>     </form>
>   </formset>
> 
> how can I get
> 
> Form "Aftermaket"
> Field
>   property "prdCd"
>   depends (requirements) "required, mask"
>   var-value "[a-zA-Z0-9]*"

Form form = resources.getForm(Locale.getDefault(), "Aftermarket")
Field field = form.getField("prdCd");
String depends = field.getDepends();

David


> Form "SomeOtherField"
> Field
>   property "fieldone"
>   depends "required"
> Field....
> Form "SomeOtherForm"
> 
> Please help me with this. Thank you.
> 
> Qin
> 
> 
> 
>
----------------------------------------------------------------------------------------
> 
> This is a PRIVATE message. If you are not the intended recipient, please
> delete without copying and kindly advise us by e-mail of the mistake in
> delivery. NOTE: Regardless of content, this e-mail shall not operate to
> bind CSC to any order or other contract unless pursuant to explicit
> written
> agreement or government initiative expressly permitting the use of
> e-mail
> for such purpose.
>
----------------------------------------------------------------------------------------
> 
> 
> 
> 
>                                                                         
>                                   
>                       David Graham                                      
>                                   
>                       <grahamdavid1980         To:      Jakarta Commons
> Users List                         
>                       @yahoo.com>             
> <commons-user@jakarta.apache.org>                           
>                                                cc:                      
>                                   
>                       09/10/03 03:31           Subject: Re: [validator]
> validator dtd or schema            
>                       PM                                                
>                                   
>                       Please respond                                    
>                                   
>                       to "Jakarta                                       
>                                   
>                       Commons Users                                     
>                                   
>                       List"                                             
>                                   
>                                                                         
>                                   
>                                                                         
>                                   
> 
> 
> 
> 
> --- Qin Ding <qding@csc.com> wrote:
> > Here is my goal: validation.xml contains all the user-defined the
> > validation requirements for each bean and every fields for a given
> bean.
> > In
> > a validation report, I need to list the requirements and the
> validation
> > results. To do that,  I am thinking to use XML binding tool to create
> > java
> > objects based on validation dtd or schema; and then I can populate the
> > generated java object using the validation.xml.  After that, I can get
> > the
> > rules for each bean from java to velocity report.
> >
> > I use Sun's JAXB tool to build java objects based on
> validation_1_1.dtd.
> > However, when I tried to generate the java files, I got the error
> > stating
> > that validation_1_1.dtd is not well-formed (first line).
> >
> > Now, my questions:
> > (1) is validation_1_1.dtd the latest version?
> 
> Yes.
> 
> >I saw in the common line I
> > need to use validator_1_0.dtd.  So, I tried that file. I still got the
> > same
> > error.
> > (2) does validation.xml have schema file (ie xsd file)?
> 
> No.
> 
> > If so, where I
> > can
> > get a copy of the schema?
> > (3) how does validator handling xml to java internally?  Is there an
> > easy
> > way to extract the rules from validation.xml?
> 
> Validator uses Commons Digester to turn validation.xml files into Java
> objects.  See the ValidatorResources constructor for an example.
> 
> David
> 
> >
> > Please advise me. Thank you very much.
> >
> > Qin
> >
> >
> >
>
----------------------------------------------------------------------------------------
> 
> >
> > This is a PRIVATE message. If you are not the intended recipient,
> please
> > delete without copying and kindly advise us by e-mail of the mistake
> in
> > delivery. NOTE: Regardless of content, this e-mail shall not operate
> to
> > bind CSC to any order or other contract unless pursuant to explicit
> > written
> > agreement or government initiative expressly permitting the use of
> > e-mail
> > for such purpose.
> >
>
----------------------------------------------------------------------------------------
> 
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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


Mime
View raw message