xml - 用于抓取所有元素的 XML xPath 语法
问题描述
需要从此输出中获取:对于 NameRecomendation:标记所有值并将其存储到组合框。
xml输出:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<GetCategorySpecificsResponse xmlns="urn:ebay:apis:eBLBaseComponents">
<Timestamp>2018-10-29T18:44:11.220Z</Timestamp>
<Ack>Success</Ack>
<CorrelationID>xxxxx</CorrelationID>
<Version>1077</Version>
<Build>E1077_CORE_API6_18790878_R1</Build>
<Recommendations>
<CategoryID>10986</CategoryID>
<NameRecommendation>
<Name>Brand</Name>
<ValidationRules>
<ValueType>Text</ValueType>
<MaxValues>1</MaxValues>
<SelectionMode>FreeText</SelectionMode>
<VariationSpecifics>Disabled</VariationSpecifics>
</ValidationRules>
<ValueRecommendation>
<Value>Unbranded</Value>
<ValidationRules />
</ValueRecommendation>
<ValueRecommendation>
<Value>Handmade</Value>
<ValidationRules />
</ValueRecommendation>
<ValueRecommendation>
<Value>Affinity</Value>
<ValidationRules />
</ValueRecommendation>
<ValueRecommendation>
<Value>Agatha</Value>
...
但我似乎错过了一些东西。我尝试使用 xPath,但它不会显示节点
Dim MyXML As New XmlDocument()
MyXML.LoadXml(RichTextBox1.Text)
Dim MyXMLNode As XmlNodeList = MyXML.SelectNodes("//*/NameRecommendation")
For Each node In MyXMLNode
'// add item to comboboxBrand
Next
试过了
Dim MyXMLNode As XmlNodeList = MyXML.SelectNodes("//NameRecommendation")
编辑 :
通过调试器,我实际上在 xml 文档中找到了该节点
解决方案
推荐阅读
- python - SciPy:solve_bvp 问题二阶差分。方程
- go - 使用更新的 CommonName 重新生成新的 x509 证书
- bash - 如何只允许小写字母作为 Bash 中的输入参数
- css - 适合 SVG 的路径
- sql - 将两个查询合并在一起
- mongodb - Mongo聚合查询过滤一个用户的最小数量和记录数的记录
- php - MailChannel 上的 Laravel 通知错误
- angular - 在 JHipster 中拖放重新排序的列表:推荐什么?
- machine-learning - 是否可以在 4 个特征上训练数据并仅使用特征进行测试?
- mysql - 我们如何减去两列并存储在 laravel 的另一列中,我是 laravel 的新手