Html 在sqlserver中使用XPath如何返回标记的所有混合内容
比如说 选择此节点时Html 在sqlserver中使用XPath如何返回标记的所有混合内容,html,sql-server,xpath,Html,Sql Server,Xpath,比如说 选择此节点时 <p> This is an open access article under the terms of the <url href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution‐NonCommercial‐NoDerivs</url> License, which permits use and di
<p>
This is an open access article under the terms of the
<url href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution‐NonCommercial‐NoDerivs</url>
License, which permits use and distribution in any medium, provided the original work is properly cited, the use is non‐commercial and no modifications or adaptations are made.
</p>
我得到
这是一篇基于知识共享署名非商业性NoDerivs许可条款的开放获取文章,允许在任何媒体中使用和分发,前提是原作被正确引用,使用是非商业性的,并且未进行任何修改或改编
但我真正想要的是
<p>
This is an open access article under the terms of the
<url href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution‐NonCommercial‐NoDerivs</url>
License, which permits use and distribution in any medium, provided the original work is properly cited, the use is non‐commercial and no modifications or adaptations are made.
</p>
这是一篇根据
知识共享属性-非商业性-非商业性
许可证,允许在任何媒介中使用和分发,前提是原作被正确引用,使用是非商业性的,并且未进行任何修改或改编。
仍然嵌入html标记
当我使用text()
evaluator时,得到的数据更少。url节点被完全删除
这是一篇许可条款下的开放获取文章,允许在任何媒体中使用和分发,前提是正确引用了原始作品,使用是非商业性的,并且未进行任何修改或改编
欢迎提出任何建议
此数据将从数据库显示在网页上,因此如果我可以保存html标记以供使用,那就太好了。您可以尝试使用XML方法而不是
value()
来获取原始XML数据,例如:
select
CONVERT(VARCHAR(MAX), pMetaUnitlegal.query('*:p')) legal_statement
from XMLwithOpenXML
OUTER APPLY
XMLData.nodes('/*:component/*:header/*:publicationMeta[@level = "unit"]/*:legalStatement') pmul(pMetaUnitlegal)
这是演示的一个工作示例:
declare @xml XML = '<p>
This is an open access article under the terms of the
<url href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution‐NonCommercial‐NoDerivs</url>
License, which permits use and distribution in any medium, provided the original work is properly cited, the use is non‐commercial and no modifications or adaptations are made.
</p>'
select CONVERT(VARCHAR(MAX), @xml.query('p'))
declare@xml=”
这是一篇根据
知识共享属性-非商业性-非商业性
许可证,允许在任何媒介中使用和分发,前提是原作被正确引用,使用是非商业性的,并且未进行任何修改或改编。
'
选择CONVERT(VARCHAR(MAX),@xml.query('p'))
你好。非常感谢您的帮助。@user326830不客气:)那么别忘了这个答案
declare @xml XML = '<p>
This is an open access article under the terms of the
<url href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative Commons Attribution‐NonCommercial‐NoDerivs</url>
License, which permits use and distribution in any medium, provided the original work is properly cited, the use is non‐commercial and no modifications or adaptations are made.
</p>'
select CONVERT(VARCHAR(MAX), @xml.query('p'))