我尝试从这样的XML解析XML与2 “值”
<article>
<attachments/>
<technical>
<feature classification="ETIM 5.0" code="EF000889" language="pl" value="EV000074">
<name>Some name</name>
<value>1234</value>
</feature>
<feature classification="ETIM 5.0" code="EF000881" language="pl">
<name>Some name</name>
<value>345</value>
<unit>A</unit>
</feature>
</technical>
</article>
在PowerShell中我写了选择一个值:
[xml]$p = Invoke-WebRequest -Uri 'https://domain.tld/file.xml'
$p.article.technical.feature | select code, value, unit
这项工作几乎完美的,但是当一个功能有自己的价值,我越来越像数组:
code value unit
EF000889 {EV000074, 1234}
EF000881 345 A
任何人hav e想法如何获得第二个价值?
$ p.article.technical.feature.value [1]? –
@Kayasax会不会丢弃下一个“功能”的第二个值?也许操作者正在寻找忽略基于属性的值。 – Matt
@Matt是的,我认为这是我想要的 –