powershell xml select attribute value where clause

后端 未结 2 921
清歌不尽
清歌不尽 2021-01-27 04:36

I have a xml file with the following elements:




        
2条回答
  •  半阙折子戏
    2021-01-27 04:48

    Use XPath. Assuming that $qrda is your XML document:

    $path = "/ClinicalDocument/recordTarget/patientRole/telecom[@use='HP']"
    $telecom = $qrda.SelectSingleNode($path)
    

    since that path is pretty long and overly specific we can trim it down:

    $telecom = $qrda.SelectSingleNode("//telecom[@use='HP']")
    

提交回复
热议问题