I have an XML document that contains the following
...
<foo>abc</foo>
...
If I evaluate
return $xml//foo
I get back
<foo>abc</foo>
Is there any way to get just abc
instead?
Yes, you want the text() function for selecting the child text:
return $xml/text()
Be careful if you will have nested tag structure inside $xml though, because this will only go one level deep for text nodes. If you want all of the text nodes together, stripping out other XML structure, this will do arbitrarily deep:
return $xml//text()
使用字符串函数获取节点的字符串内容。
return string($xml)
要仅返回元素内的数据,您可以使用:
return data($xml)
转换为xs:string {xs:string($xml/foo)}
OSB(oracle服务总线)用户可以使用以下功能。
fn-bea:serialize($xml)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.