4
我有一個xml如下面:獲取XML屬性
<Phrase Entry="ID">
<Ans number="1">
<Identification LastName="Bornery" Name="John" Age="23"/>
<Identification LastName="Grify" Name="Johnson" Age="29"/>
<Identification LastName="Alisen" Name="Julia" Age="38" City="NewYork" Job="Teacher"/>
<Identification LastName="Bornery" Name="John" Weight="85"/>
</Ans>
</Phrase>
,我想列出的XML列表以及它們的屬性值,如以下列表:
MyList = {LastName="Bornery" , Name="John", Age="23" , LastName="Grify" ,
Name="Johnson", Age="29", LastName="Alisen",
Name="Julia", Age="38", City="NewYork", Job="Teacher",
LastName="Bornery", Name="John", Weight="85"}
XML節點具有'Attributes'集合,因此遍歷所有節點 –