xml - XPath for Descriptor in Node
问题描述
I'm trying to set properties and confused as to what the xpath would be. For example, one of my properties is
props['SuperiorOrganization'] = parts[0].xpath('/rs:Report_Entry/rs:SuperiorOrganization/Descriptor')
and I tried using rs:/descriptor
with no value.
My xml is returning something like this:
<wd:SuperiorOrganization wd:Descriptor="Name of Supervisory">
<wd:ID wd:type="WID">XXXXXXXXXXXXXXXXXXX</wd:ID>
<wd:ID wd:type="Organization_Reference_ID">XXXXXX</wd:ID>
解决方案
rs:Descriptor
是一个属性,属性必须@
在 XPath 表达式中加上前缀。所以一个工作表达式来获取字符串
监事姓名
可能
/rs:Report_Entry/rs:SuperiorOrganization/@rs:Descriptor
(假设 thers:
和wd:
命名空间是可互换的。)
推荐阅读
- python - 使用 python 套接字的 FIN/ACK 通知
- reactjs - 如何使用socket.io在本机反应中为Web基础应用程序创建与后端服务器的聊天连接?
- python - Python:尽管明显存在,但看不到功能
- vb.net - 是否可以在未安装引擎的情况下使用 ADODB/OleDB 连接?
- ruby-on-rails - 如何在变量中添加数组并通过get方法将其发送到url
- excel - 过滤列表范围内的唯一值
- c# - 当我使用参数化查询时出现此错误(必须声明标量变量@“regNo”)
- java - 尝试通过android调用JSON api时出现无效请求错误
- android - 适用于 Ios 和 Android 的一种 URL 方案
- javascript - React Native:使用 FlatList 和 DatePicker 创建时间列表