Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Check Required Elements and Attributes in JAXB

 
maliheh shariat
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I need check required elements and attributes in JAXB java classes , if there are any value for them place it , otherwise place default value in xml file , because of it I upgrade JAXB2.0 to JAXB 2.1 to support "required" in "XmlElement" , I read in "JavaWS(JAXB)Tutorial.pdf" that JAXB itself check required elements and attributes , if there are any value for them place it , otherwise place default value in xml file , the exact part of document is :
<< A property is said to have a set value if that value was assigned to it during unmarshalling or by invoking its mutation method. The value of a property is
its set value, if defined; otherwise, it is the property�s schema specified default value, if any; otherwise, it is the default initial value for the property�s base type as it would be assigned for an uninitialized field within a Java class. >>


I want to know , dose JAXB do this task ? (now I work with JAXB2.1 but it doesnt do this task.Maybe I must set some configuration)
and if JAXB doesnt do it , how I can check required elements and attributes in JAXB ?

Please help me.

Shariat
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic