<physicalResource>
<prName>PRS_EID</prName>
<prDescription>PRS_EID</prDescription>
<physicalResourceCharacteristic>
<characteristic>
<name>eidno</name>
<value>SH001499000</value>
</characteristic>
<characteristic>
<name>flatno</name>
<value>14303</value>
</characteristic>
</physicalResourceCharacteristic>
</physicalResource>
<physicalResource>
<prName>PRS_OLT</prName>
<prDescription>PRS_OLT</prDescription>
<physicalResourceCharacteristic>
<characteristic>
<name>device</name>
<value>WC-OMU-AO01</value>
</characteristic>
<characteristic>
<name>frame</name>
<value>1</value>
</characteristic>
<characteristic>
<name>port</name>
<value>5</value>
</characteristic>
</physicalResourceCharacteristic>
</physicalResource>
Hello Dears ..我有一個xml文件。它包含具有相同節點名稱的不同節點。在physicalResource節點下的示例中,我想提取prName和所有特徵的名稱和值。但我不能單獨解析它們。 我使用從多個節點中的單個節點解析出具有相同名稱的多個節點
nodeListPrs = root.SelectNodes("/physicalResource/physicalResourceCharacteristic/characteristic", nsmgr);
它提取兩個節點的所有charactics值。我怎樣才能從單個物理資源節點提取這些參數?
感謝您的回答。但我可以提取prName的。我的問題是提取特徵。我用selectnodes(physicalResource/physicalResourceCharacteristic/characteristic)。但輸出包含所有的物理資源。我想讓他們分別爲physicalResource節點1和physicalResource節點2 –
更新我的代碼 – jdweng