Let me just try to clarify one thing: XML validation.

With Castor XML, it is possible to ask for XML schema validation durign 
unmarshalling (at parsing time) without having Java classes generated from the 
XML schema. When generating classes from an XML schema, it is possible for 
Castor XML to perform validation at unmarshalling time without delegating this 
task to the XML parser. Just trying to make sure you understand the fine 
difference(s) here.

Other than that, it all depends where your preferences are, and what you want 
to achieve. Whether you are working cross-platfrom, or not, whether you tend to 
see an XML schema as the contract , or not.

Werner

> -----Original Message-----
> From: Sandeep [mailto:[EMAIL PROTECTED] 
> Sent: Dienstag, 09. Jänner 2007 10:34
> To: [email protected]
> Subject: [castor-user] SourceCodeGenerator vs Mapping.xml
> 
> Hi
> 
> Which is better:
> 1. Define a schema for a java bean, auto-generate the source 
> code and get the validation done by castor while populating 
> the bean from a xml instance.
> 
> 2. Hand code the java bean. Define a mapping file. Populate 
> the java bean from a xml instance through castor. I don't 
> think I need to define a schema here (correct me, if I am wrong)
> 
> Advantage for 1) is validation of data types and values can 
> be performed by castor.
> Advantages for 2) are flexibility to add application specific 
> helper methods to the bean, or when  you cannot touch the 
> source for the bean.
> 
> Obviously, advantage of one is the disadvantage for the other.
> 
> So, how can I get the best of both worlds? I want to hand 
> code my bean class (not use SourceCodegenerator). I want to 
> define the schema apart from the mapping so that castor can 
> validate the xml instance against the schema for both data 
> types and some values.
> 
> 
> TIA
> 
> ~Sandeep
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to