Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Castor | Default Element Value

 
Tausif Farooqi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Does anyone know if it is possible to set a default value for an element or attribute when we use Castor to marshal an object to XML? The objects that are marshalled to XMLs are fetched from a database. Some of the fields of these objects maybe NULL and hence their coresponding XML field/attribute is not printed in the XML. Is there a way to give a default value to such fields so that even if the database value is NULL it will display the default value in the XML (other than using a null check for all such fields in Java code)?

Thanks,

Tausif
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic