• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML-to-Java mappings used by JAX-WS

 
aruna sydu
Ranch Hand
Posts: 98
MyEclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

This is with reference to question 20 in http://www.cheat-test.net/Samples/310-230-Exam.html.
However i could not make out how this can be decided.

Please explain.


20. According to the XML-to-Java mappings used by JAX-WS, which three elements or attribute
declarations are mapped to a Java primitive wrapper class (for example, java.lang.Short)? (Choose three.)
A. <xsd:element name="age" type="xsd:short" minOccurs="0"/>
B. <xsd:element name="age" type="xsd:short" nillable="true"/>
C. <xsd:element name="age" type="xsd:short" nillable="false"/>
D. <xsd:attribute name="required" type="xsd:boolean" use="optional"/>
E. <xsd:attribute name="required" type="xsd:boolean" use="required"/>
F. <xsd:attribute name="required" type="xsd:boolean" nillable= false/>
Answer: ABD

 
Stefan Taranu
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

To start: point F is false because attributes can not be "nillable"

For the others, if you hve a primitive in java the mapping could not be nillable nor minOccurs=0 - this is because primitives can not be null. So if you want to map an XML element/attribute to a Wrapper (which can be null) you should use nillable="true" or minOccurs=0 (which also means that the element could be absent)

I don't know if I made myself clear. Here is (maybe) some more information: http://www.ibm.com/developerworks/xml/library/ws-tip-null.html

P.S.

I'm also preparing ofr SDJWS and now I'm looing for mock exams. I was not aware of this one. Do you have others?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic