commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dmitri Plotnikov" <dmi...@apache.org>
Subject Re: Evaluating null value in getValue?
Date Fri, 18 Jun 2004 01:31:55 GMT
You may want to use the built-in XPath function null() instead of simply
"null".

- Dmitri

----- Original Message ----- 
From: "Nassim Chalfouh" <nassim.chalfouh@prima-solutions.com>
To: <commons-user@jakarta.apache.org>
Sent: Tuesday, June 15, 2004 5:16 AM
Subject: Evaluating null value in getValue?


Hi all,
i have the following classes:
public class Holder {

private String name;

private Holder sub;

Holder() {

name = "aaa";

sub = null;

}

public String getName() {

return name;

}

public Holder getSub() {

return sub;

}

}

and the sample code:
Holder h = new Holder();

JXPathContext jc = JXPathContext.newContext(h);

System.out.println((String) jc.getValue("name"));

System.out.println(jc.getValue("name='aaa'"));

System.out.println(jc.getValue("sub"));

System.out.println(jc.getValue("sub=null"));

The results are:

aaa

true

null

false         <---------- I expected true!

i tried to change the

System.out.println(jc.getValue("sub='null'"));

but the output is still 'FALSE'

how can i test a null value in getValue method?

Thanks a lot for your help

Best regards,







_______________________________________________________________________

Nassim Chalfouh    |    Quality Assurance                     Direct
Line : +33 1 70 91 24 41
PRIMA SOLUTIONS

Delivering the Unified Insurance Front-End
http://www.prima-solutions.com <http://www.prima-solutions.com/>

_______________________________________________________________________

This e-mail message is a private and confidential correspondence
intended only for use of the individual or entity
named above. If you are not the intended recipient, or the agent
responsible to deliver it to the intended recipient,
you are hereby notified that any dissemination, distribution or copying
of this communication is strictly prohibited.
If you have received this communication in error, please immediately
notify us by return e-mail by clicking on the
e-mail address shown at the bottom of this note or by  phone (+ 33 1 70
91 24 30), and delete it there after from
your system. Thank you.





---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message