Quantcast
Channel: Metro and JAXB Related Items on Java.net
Viewing all articles
Browse latest Browse all 171

JAXB XmlElement - Problem with Arrayfields

$
0
0

Hi,

I have used below getter method level XmlElement annotation for generating xsd from Java class.
@XmlElement(type=Integer.class, required=true)
public int [] getTestArrayInt () { .... }

Generated XML element:

minOccurs's default value is said to be 1. Hence, it is not being displayed here.
But maxOccurs="unbounded" which should be listed for Array elements is missing. Soap UI expects maxOccurs="unbounded" to be present for the array elements. As a result, in Soap UI, this element is not being treated as an array.

When I have removed type=Integer.class from the annotation, I started getting maxOccurs="unbounded" in the XML. But I need this type specially for primitive datatypes. Without type in annotation, minOccurs=1 gets missing for elements which are not required (i.e. required =true is not set).

Can someone please help me in this?

Thanks in advance,
Saumya


Viewing all articles
Browse latest Browse all 171

Trending Articles