Xquery 中的 data() 函数和 string() 函数之间的实际区别是什么?当我使用它们时,它们似乎都返回相同的结果。有人可以给我一个简单的例子来说明它们有何不同吗?
let $dataset :=
<data-set cool="rad">
<!--- This is a comment -->
<pages cool2="rad2" more="i guess">
<page>
<title>Puppy</title>
<content>Puppies are great!</content>
</page>
<page>
<title>Dogs</title>
<content>Dogs are grown up!</content>
</page>
<page>
<title>Puppy</title>
<content>Puppies are great!</content>
</page>
</pages>
</data-set>
return $dataset/string()
(: data() returns the same thing as string() :)
(: return $dataset/data() :)