我的XML文件条目:
<GlobalView xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<rels>
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
</rels>想要查询关系元素中的属性Id ..。我正在使用下面给出的查询,它一直工作到元素关系,而不给我Id属性值。
for $file in doc("C:/Users/Raffay/Desktop/RnDxr.xml")
return $file/GlobalView/child::rels/child::Relationship预先感谢
发布于 2010-07-27 20:29:50
试一试
GlobalView/child::rels/child::Relationship/@Id或缩写形式
GlobalView/rels/Relationship/@Id发布于 2010-07-28 13:08:09
使用
declare default element namespace
"http://schemas.openxmlformats.org/package/2006/relationships";
let $vIds :=
for $file in doc("C:/Users/Raffay/Desktop/RnDxr.xml")
return $file/GlobalView/rels/Relationship/@Id提供的原始代码有两个明显的问题
$file 中包含的XML文档具有默认的名称空间。在没有默认元素命名空间声明的情况下,表达式中的所有无前缀名称都被认为属于“无命名空间”,也不会选择任何节点。Relationship 元素,但是这个元素的属性Id才是真正需要的。https://stackoverflow.com/questions/3347495
复制相似问题