File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Check Required Elements and Attributes in JAXB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Check Required Elements and Attributes in JAXB " Watch "Check Required Elements and Attributes in JAXB " New topic
Author

Check Required Elements and Attributes in JAXB

maliheh shariat
Greenhorn

Joined: Sep 15, 2008
Posts: 1
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Check Required Elements and Attributes in JAXB