简体   繁体   English

XQuery数据和text()函数

[英]XQuery data and text() function

Sorry even trying to watch tutorials I am just trying to understand the difference between the data() and the text() functions in XQuery. 抱歉甚至尝试观看教程,我只是想了解XQuery中data()text()函数之间的区别。

Any clarification is appreciated. 任何澄清表示赞赏。

text() is used to match something. text()用于匹配某些内容。 For example if we have this structure: 例如,如果我们具有以下结构:

<a>
  <b>hello <c>world</c></b>
</a>

Doing //b/text() will return the text node 'hello ' just like //b/element() will return the element c. // b / text()将返回文本节点“ hello”,就像// b / element()将返回元素c一样。

data($arg) is a function that returns the atomic value of a node, for example data(//b) will return 'hello world'. data($ arg)是一个返回节点原子值的函数,例如data(// b)将返回“ hello world”。 If you use the data($arg) function on a document with a schema then the type will be kept intact. 如果在具有模式的文档上使用data($ arg)函数,则该类型将保持不变。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM