XQuery-字符串是隐式节点吗?

XQuery-字符串是隐式节点吗?,xquery,sequence,nodes,Xquery,Sequence,Nodes,e、 g 将下列内容描述为一系列文本节点是否准确 ("foo", "bar", "baz") 不,他们不是。字符串不等于文本节点,这是一个字符串序列 文本节点的类型为节点,这也是项(它们是XQuery中最常用的数据类型)。字符串派生自xs:anyAtomicType,它也是项 看一看 确定项目的类型 可以使用 (text { "foo" }, text { "bar" }, text { "baz" }) 您可以使用typeswitch结构轻松确定节点的类型: for $item in (t

e、 g

将下列内容描述为一系列文本节点是否准确

("foo", "bar", "baz")

不,他们不是。字符串不等于文本节点,这是一个字符串序列

文本节点的类型为
节点
,这也是
(它们是XQuery中最常用的数据类型)。字符串派生自
xs:anyAtomicType
,它也是

看一看

确定项目的类型 可以使用

(text { "foo" }, text { "bar" }, text { "baz" })
您可以使用
typeswitch
结构轻松确定节点的类型:

for $item in (text { "foo" }, "bar", 42)
return
  typeswitch($item)
    case text()
      return "text node"
    case xs:string
      return "string"
    default
      return "Something else"
继承类型 您还可以测试继承的类型:

for $item in (text { "foo" }, "bar", 42)
return
  typeswitch($item)
    case node()
      return "node"
    case xs:anyAtomicType
      return "anyAtomicType"
    default
      return "Something else"

不,他们不是。字符串不等于文本节点,这是一个字符串序列

文本节点的类型为
节点
,这也是
(它们是XQuery中最常用的数据类型)。字符串派生自
xs:anyAtomicType
,它也是

看一看

确定项目的类型 可以使用

(text { "foo" }, text { "bar" }, text { "baz" })
您可以使用
typeswitch
结构轻松确定节点的类型:

for $item in (text { "foo" }, "bar", 42)
return
  typeswitch($item)
    case text()
      return "text node"
    case xs:string
      return "string"
    default
      return "Something else"
继承类型 您还可以测试继承的类型:

for $item in (text { "foo" }, "bar", 42)
return
  typeswitch($item)
    case node()
      return "node"
    case xs:anyAtomicType
      return "anyAtomicType"
    default
      return "Something else"