<?xml version="1.0" encoding="UTF-8"?>
<collection>
<mods xmlns="http://www.loc.gov/mods/v3" xmlns:etd="http://www.ntltd.org/standards/metadata/etdms/1.0/etdms.xsd" xmlns:local="http://idea.library.drexel.edu" xmlns:mods="http://www.loc.gov/mods/v3" xmlns:datacite="https://schema.datacite.org/meta/kernel-4.0/metadata.xsd" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier type="assetId">16</identifier>
<identifier type="doi">10.17918/D8VD4T</identifier>
</mods>
</collection>
我的选择器是空的,为什么我在我运行相同的表达式和XML文件的情况下没有任何结果,并且在https://www.freeformatter.com/xpath-tester.htester.html
它提供了结果?
XdmNode.getExternalNode()
仅当XDM节点是外部节点(例如DOM节点)的包装器/视图时,才会返回结果。使用SaxonDocumentBuilder
在Mike在答案中写的内容,如果您有
XdmNode
node
并想要其字符串内容,则可以使用node.getStringValue()
该方法的文档
getTextContent()
在https://www.saxonica.com/html/documentation10/javadoc/net/net/saxon/saxon/s9api/xdmitem.htmitem.html#getStringvalue--