我需要幫助來搜索多個字符串的多個XML文件,然後將結果輸出到csv或txt文件中。這些xml文件都是相同的格式。Powershell:搜索多個字符串多個XML並將結果輸出到csv
此刻,我可以只使用提取單個XML單一字符串如下:
$xml = [xml](Get-Content 'C:\App\test.xml')
$xml.application.stage1.c_firstname
它返回的名字,我需要能夠返回c_surname
和c_userid
並輸出到CSV文件(理想或多個XML
示例XML文件中的文本):
<?xml version="1.0" encoding="UTF-8" ?>
<application>
<stage1>
<c_product_name>Test</c_product_name>
<c_firstname>Bill</c_firstname>
<c_surname>Gates</c_surname>
</stage1>
<stage5>
<c_number>12345TEST</c_number>
</stage5>
</application>
請避免張貼「謝謝」評論。在SO上表達感謝的正確方式是upvote和/或[接受](http://meta.stackexchange.com/a/5235)答案。 –