0

I am trying to use JAXB 1.0 provided by JDeveloper 10g version. I have created a Schema definition with elements having default values. I have following questions:

  1. Whenever I create the Java Content tree using the JAXB generated classes, the java objects should have been created with the default values mentioned in the XML schema. But it doesn't happen. How to make JAXB create the Java objects of an XML document with default values of the elements?
  2. I am trying to add the schemalocation to the marshalled XML document using Marshaller.setProperty( Marshaller.JAXB_SCHEMA_LOCATION, "http://mylocation"); But its not getting reflected in the marshalled XML content.

1 Answer 1

3

Have a look at JAXB default value plugin. Some nice additional plugins are mentioned here.

1
  • 3
    @mR_fr0g: With all my respect to you: (a) The answer was given in 2010 – at that moment the link was available (b) If the project is dead, this is not a reason of downvoting. The sources of plugin are e.g. available here (centurion.dynalias.com/svn/public/trunk/programming/java/…) – feel free to download, compile, adapt for your needs and use it!
    – dma_k
    Aug 9, 2011 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.