对于这个xml
<locations>
<location>
<locationid>1</locationid>
<homeID>281</homeID>
<buildingType>Added</buildingType>
<address>A</address>
<address2>This is address2</address2>
<city>This is city/city>
<state>State here</state>
<zip>1234</zip>
</location>
<location>
<locationid>2</locationid>
<homeID>81</homeID>
<buildingType>Added</buildingType>
<address>B</address>
<address2>This is address2</address2>
<city>This is city/city>
<state>State here</state>
<zip>1234</zip>
</location>
.
.
.
.
<location>
<locationid>10</locationid>
<homeID>21</homeID>
<buildingType>Added</buildingType>
<address>Z</address>
<address2>This is address2</address2>
<city>This is city/city>
<state>State here</state>
<zip>1234</zip>
</location>
</locations>
如何使用etree
为地址A
获取{
这是我的密码
^{pr2}$得到输出为None
,我在这里做了什么错误?在
首先,您的
xml
格式不好。你应该在发布时更加小心,尽量避免让其他用户修改你的数据。可以搜索前面的同级项,例如:
或者直接从
^{pr2}$xpath
表达式执行,例如:按以下方式运行:
这个收益:
^{4}$相关问题 更多 >
编程相关推荐