This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 508 - XPathEvaluator_evaluate_TYPE_ERR is wrong
Summary: XPathEvaluator_evaluate_TYPE_ERR is wrong
Status: RESOLVED FIXED
Alias: None
Product: DOM TS
Classification: Unclassified
Component: DOM Level 3 (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Curt Arnold
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-26 18:32 UTC by Peter Van der Beken
Modified: 2004-03-10 20:51 UTC (History)
1 user (show)

See Also:


Attachments
Changed test per comment (1.45 KB, patch)
2004-03-10 15:51 UTC, Curt Arnold
Details

Description Peter Van der Beken 2004-01-26 18:32:42 UTC
The XPathEvaluator_evaluate_TYPE_ERR selects the document root and asks for a
number result. This is a completely valid conversion in XPath and shouldn't
raise the TYPE_ERR exception. The number function converts a nodeset to a string
as if by a call to the string function and then converts the resulting string.
The string function converts a nodeset to the string-value of the node in the
node-set that is first in document order.
See http://www.w3.org/TR/xpath#function-number and
http://www.w3.org/TR/xpath#function-string

One way to get a TYPE_ERR is for example trying to get a node iterator or a
snapshot or a node from an expression that returns a string or a number or a
boolean (eg. "string(something)" and evaluate that to FIRST_ORDERED_NODE_TYPE).
The inverse doesn't seem possible since the string(), boolean and number()
functions defined in http://www.w3.org/TR/xpath#corelib are used to convert the
result to the requested type for STRING_TYPE, NUMBER_TYPE and BOOLEAN_TYPE. As
you can see those conversions are defined for converting from all other result
types.
Comment 1 Curt Arnold 2004-03-10 15:51:29 UTC
Created attachment 300 [details]
Changed test per comment