DOM L3 XPath: Multiple matching nodes when number, string or boolean type

Related to the recent singleNodeValue thread, I'm not sure if the case of multiple matching nodes has been adequately addressed for non-node return types.  For example, asking the query /svg/rect/@width with a number return type on the following document:

<svg><rect width="100"/><rect width="200"/><svg>

The options that I see would be:

a) Following the pattern of number() and string() in XPath and return the first matching value.

b) Throw an exception, though it should be distinct from TYPE_ERR.

c) Separate multiplicity and ordering from the return type parameter and have doubleValue, booleanValue, stringValue (and nodeValue for node snapshots?) return array types.

d) Separate multiplicity and ordering from the return type and have doubleValue, booleanValue, and stringValue have an index parameter.

However, I don't believe the scenario is adequately addressed in the current draft.  My initial leaning would be toward option c, however I would assume that array types are avoided intentionally in the DOM.

Received on Saturday, 16 February 2002 19:35:04 UTC