Hi All,
I've been playing with native JSON in XQuery, and was surprised to see that
fn:string() returns a zero-length string when passed a number-node or
boolean-node. On the contrary, an explicit cast expression works as expected.
The documentation for fn:string($arg) states: "If $arg is a node, the function
returns the string-value of the node, as obtained using the dm:string-value
accessor."
Is this a bug, or simply a consequence of the JSON node hierarchy?
Thanks.
-jb
Here's a few test-cases:
1,
fn:string(1),
number-node{1},
fn:string(number-node{1}),
fn:string(fn:data(number-node{1}))
,
1,
1 cast as xs:string,
number-node{1},
number-node{1} cast as xs:string
,
fn:true(),
fn:string(fn:true()),
boolean-node{1},
fn:string(boolean-node{1}),
fn:string(fn:data(boolean-node{1}))
,
fn:true(),
fn:true() cast as xs:string,
boolean-node{1},
boolean-node{1} cast as xs:string
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general