我想獲得一個節點例如爲如下: 我怎麼能得到父親的職業,我使用的代碼如何獲取XML節點
oNotificationDoc.Load(sFileName);
oNodeListPerson = oNotificationDoc.GetElementsByTagName("Person");
XmlNode oNodeFather = null;
oNodeFather = oNodeListPerson.Item(2);
XmlNode oNodeGeneral_temp = oNodeFather.SelectSingleNode("//NmSpace:" + Occupation, nsmgr);
但是,讓媽媽的職業回報。
<Person DOB="23121964" Role="Mother" ApproxDateOfMarriage="2" DateOfMarriage="10062015" MaritalStatus="1" Nationality="CN" PPSN="" ApproxDOB="2">
<PersonName Surname="TEST" Forename1="TEST" OtherSurnames="" BirthSurname="TEST"/>
<MothersBirthSurname>TEST</MothersBirthSurname>
<Address Type="Residential" Country="IE" County="D07" Line4="" Line3="TEST" Line2="TEST" Line1="TEST"/>
<Occupation>BARISTA</Occupation>
<PrevPregDetails PrevSponAbortions="0" PrevLateFetalDeaths="0" PrevChildrenStillLiving="0" PrevLiveBirths="0" ApproxDateOfLastBirth="" DateOfLastBirth=""/>
</Person>
<Person DOB="12101972" Role="Father" Nationality="CN" PPSN="" ApproxDOB="2">
<PersonName Surname="TEST" Forename1="TEST" OtherSurnames="UNKNOWN" BirthSurname="TEST"/>
<MothersBirthSurname>TEST</MothersBirthSurname>
<Address Type="Residential" Country="AA" County="" Line4="" Line3="TEST" Line2="TEST" Line1="TEST"/>
<Occupation>WAITER</Occupation>
</Person>
請告訴你如何訪問'oNodeFather'! –
我修改了問題 –
請說明如何訪問'oNodeListPerson'! –