Kaushik Prakash

Greenhorn
+ Follow
since Mar 23, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kaushik Prakash

Hi,
I am facing a problem while unmarshalling into a Java bean from an xml. I am using Castor unmarshaller to populate the xml values into a Java bean. The problem is as follows:

In an xsd I have a simple type defined as follows:
<xs:simpleType name="ListTest">
<xs:list itemType="xs:string"/>
</xs:simpleType>

In the same xsd I have specified an element List as follows:

<xs:element name="List " type="ListTest" minOccurs="0" maxOccurs="1" nillable="true"> </xs:element>.

I use this xsd to validate my sample xml which has a field by name List
<List>abc def ghi</List>.

When I am unmarshalling the xml I am able to populate these values into a string array successfully.

But when the same element doesn't have any element, ie <List></List>, while unmarshalling I get a Null Pointer Exception. My inference is that in case of elements which are of type list, Castor expects elements to be present so that it can assign them into a string array object. In some cases there will be a valid scenario where elements will not be present. Could anyone help me out with this problem. Is there any other declaration I need to make in my xsd, so that while unmarshalling, an empty array object is obtained?

Regards,
Kaushik
HI,
I am Kaushik, a new joinee. In order to prepare for the SCWCD exam, I would like to know which book is better amongst the two : Head First or SCWCD Exam study kit(by Deshmukh). I believe one of these should do, but I am unable to decide. Please help.
I would also appreciate if you could tell me some other sources to prepare from apart from the forum's links.

Thanks and Regards,
Kaushik

PS: please do not suggest links to dumps, as I strongly discourage them.