If your app doesn't need the distinction, I think the best way is to use an 
array of length 0.
 
Radu

________________________________

From: Jorge Fernandez [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 08, 2007 7:40 AM
To: [email protected]; [EMAIL PROTECTED]
Subject: Re: Null pointer exception in xmlbeans setArray


Hi Jacob, 

I had already checked that nillable was in my schema definition of the wsdl. At 
array definitions I added minOccurs="0" and I also had maxOccurs="unbounded" 
attribute. But I don't know what effect should that change have in my code. I 
tested it and still can't set an array to null. Could you, please explain me 
what should change in my code?? 


Thanks and regards,

Jorge Fernández 




Jacob Danner <[EMAIL PROTECTED]> escribió: 

        on the type, you could try, nillable="true" or minOccurs="0" in your xsd
        
        On 4/7/07, Jorge Fernandez wrote:
        > Hi Radu,
        >
        > Firsrt of all, thanks for your response.
        >
        > I don't know much about mapping Java to xml and I don't know if it's
        > possible.
        >
        > I'm accessing to a database and sometimes there's no data to recover 
so I
        > set a Java object array to null (no elements and no length). Is there 
a
        > mapping for that in xml or should I create a java array of lenght 0 
or with
        > one null element like you said??
        >
        > Regards,
        >
        > Jorge Fernández
        >
        >
        >
        > Radu Preotiuc-Pietro escribió:
        > What do you mean by setting an array to null, XML-wise?
        >
        > I can see setting an array of length 0, or setting an array of length 
1
        > containing one null element, but a null array I can't see how this 
would
        > map to XML.
        >
        > Radu
        >
        > On Thu, 2007-04-05 at 14:43 +0200, Jorge Fernandez wrote:
        > >
        > > Hi,
        > >
        > > I'm using xmlbeans as databinding in axis2. In some classes I
        > > generated with wsd2java, I have Array fields and if I set an array
        > > with a null value, I get a NPE.
        > >
        > > I have the same problem when I build the response message for my web
        > > service if I have to return null array. When I do
        > > responseElement.setReturnArray(array), and the array is null, it
        > > Throws also a NPE.
        > >
        > > With other objects I can use a setNil method but arrays only have a
        > > method for setting null a component and not the shole array.
        > >
        > > I tried to set a String field to null with the setValue method
        > > instead of setNilValue and it works perfectly. Is not possible to 
set
        > > an array to null in xmlbeans classes??
        > >
        > > Can anybody tell me what I'm doing wrong and how should I set a null
        > > array??
        > >
        > > Thanks in advance and regards,
        > >
        > > Jorge Fernández
        > >
        > >
        > >
        > >
        > >
        > >
        > >
        > ______________________________________________________________________
        > >
        > > LLama Gratis a cualquier PC del Mundo.
        > > Llamadas a fijos y móviles desde 1 céntimo por minuto.
        > > http://es.voice.yahoo.com
        >
        > Notice: This email message, together with any attachments, may contain
        > information of BEA Systems, Inc., its subsidiaries and affiliated 
entities,
        > that may be confidential, proprietary, copyrighted and/or legally
        > privileged, and is intended solely for the use of the individual or 
entity
        > named in this message. If you are not the intended recipient, and have
        > received this message in error, please immediately return this by 
email and
        > then delete it.
        >
        > ---------------------------------------------------------------------
        > To unsubscribe, e-mail:
        > [EMAIL PROTECTED]
        > For additional commands, e-mail: [EMAIL PROTECTED]
        >
        >
        >
        >
        > ________________________________
        >
        > LLama Gratis a cualquier PC del Mundo.
        > Llamadas a fijos y móviles desde 1 céntimo por minuto.
        > http://es.voice.yahoo.com
        >
        >
        
        ---------------------------------------------------------------------
        To unsubscribe, e-mail: [EMAIL PROTECTED]
        For additional commands, e-mail: [EMAIL PROTECTED]
        
        


________________________________


LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com 
<http://us.rd.yahoo.com/mail/es/tagline/messenger/*http://es.voice.yahoo.com/> 

Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.

Reply via email to