0
我需要從下面的xml讀取子節點,並需要將數據插入到數據庫中。從根節點讀取子節點
我正在使用下面一行從根節點中選擇子節點,但每次讀取第一個應用程序data.I知道我硬編碼在下面的方法中的路徑,但我不知道如何讀取子節點逐個。
XmlNodeList boxNodeList = document.SelectSingleNode("applications/application/contacts").ChildNodes;
示例XML
<applications>
<application >
<contacts>
<business-owner>
<a></a>
<b></b>
<c> </c>
</business-owner>
<it-owner>
<a></a>
<b></b>
<c></c>
</it-owner>
<architect>
<a></a>
<b></b>
<c></c>
</architect>
<dataContact>
<a></a>
<b></b>
<c></c>
</dataContact>
<technical>
<a></a>
<b></b>
<c> </c>
</technical>
<technical>
<a></a>
<b></b>
<c> </c>
</technical>
<other> </other>
</contacts>
</application>
<application >
<contacts>
<business-owner>
<a></a>
<b></b>
<c> </c>
</business-owner>
<it-owner>
<a></a>
<b></b>
<c> </c>
</it-owner>
<technical>
<a></a>
<b></b>
<c> </c>
</technical>
<other/>
</contacts>
</application>
<application >
<contacts>
<business-owner>
<a></a>
<b></b>
<c> </c>
</business-owner>
<it-owner>
<a></a>
<b></b>
<c> </c>
</it-owner>
<other/>
</contacts>
</application>
</applications>