Thanks for your feedback Steen and David. I guess its up to the application
to decide if a variable is bound to a value, by implementing the
VariableContext. e.g. with XSLT the bindings are all created up front first
before the stylesheet is invoked, so its easy to check if a variable is not
bound.

In my particular use case I know that some variables will be 'empty' and
thats fine. So this could be considered from XPath's perspective as the
variable having a value, so there is no error, but that the value is
'empty'.

Bob suggested that a good value of 'empty' would be an empty List or
Collections.EMPTY_LIST as this is equivalent to an empty node-set, which is
a valid result of many valid XPath queries.

So I guess in this thread I've been talking about empty values rather than
unbound variables.

James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "Steen Lehmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, December 03, 2002 7:13 PM
Subject: Re: [Jaxen] should using a variable with no value throw
anexception.


Let's go with the spec on this one:

"A VariableReference evaluates to the value to which the variable name is
bound in the set of variable bindings in the context. It is an error if the
variable name is not bound to any value in the set of variable bindings in
the expression context."
(XPath 1.0, section 3.1)

-- Steen

>>> "James Strachan" <[EMAIL PROTECTED]> 12/03/02 10:42 AM >>>
I guess it depends on the use case of whether variables having no value is
valid or not.

I've a use case where having variables undefined is valid, so I've gone
ahead and implemented my own VariableContext for which an empty Document is
returned if there is no value available. I guess thanks to the interface,
Jaxen users can have behaviour either way.

James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "Jan Dvorak" <[EMAIL PROTECTED]>
To: "James Strachan" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, December 03, 2002 4:11 PM
Subject: Re: [Jaxen] should using a variable with no value throw an
exception.


I'd prefer if it failed, rather than silently ignored what I think is a
clear
case of an error condition.

Jan

Dne ut 3. prosinec 2002 16:52 James Strachan napsal(a):
| If I were to evaluate the XPath:
|
|     $foo/bar/whatever
|
| Do folks think its correct behaviour to throw an exception if foo does not
| exist, or just to quietly ignore it and return no results? I thought the
| latter would be more appropriate but it seems that Jaxen right now
| implements the former.
|
| Thoughts?
|
| James

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest



-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET
comprehensive development tool, built to increase your
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET 
comprehensive development tool, built to increase your 
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to