Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 Java 8 in Action this week in the Java 8 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
 
Similar Threads
JNDI Port number issue while strating JBoss server 4.2.2.GA
Top-Down approach: WSDL, JAX-WS and JAXB
Unable to find setter method for attribute: locale
dom4j / default attributes?
hi