我將xml數據以字符串形式存儲到用戶偏好中。我想從這個xml字符串創建hashmap。請幫幫我;這裏是我的xml字符串;來自XML字符串的散列圖 - Android
String data = " <modules> <Calls> <access>89</access> <delete>90</delete> <edit>90</edit> <export>90</export> <import>90</import> <list>90</list> <view>90</view> </Calls> <Cases> <access>89</access> <delete>90</delete> <edit>90</edit> <export>90</export> <import>90</import> <list>90</list> <view>90</view> </Cases> <CFM_CoBuyer> <access>89</access> <delete>90</delete> <edit>90</edit> <export>90</export> <import>90</import> <list>90</list> <view>90</view> </CFM_CoBuyer> <Contacts> <access>89</access> <delete>-99</delete> <edit>90</edit> <export>90</export> <import>90</import> <list>90</list> <view>90</view> </Contacts> <Inv_Inventory> <access>89</access> <delete>90</delete> <edit>90</edit> <export>90</export> <import>90</import> <list>90</list> <view>90</view> </Inv_Inventory> <Meetings> <access>89</access> <delete>90</delete> <edit>90</edit> <export>90</export> <import>90</import> <list>90</list> <view>90</view> </Meetings> <Notes> <access>89</access> <delete>90</delete> <edit>90</edit> <export>90</export> <import>90</import> <list>90</list> <view>90</view> </Notes> <Opportunities> <access>89</access> <delete>-99</delete> <edit>90</edit> <export>-99</export> <import>-99</import> <list>80</list> <view>90</view> </Opportunities> <Tasks> <access>89</access> <delete>90</delete> <edit>90</edit> <export>90</export> <import>90</import> <list>90</list> <view>90</view> </Tasks> <Trd_TradeIns> <access>89</access> <delete>90</delete> <edit>90</edit> <export>90</export> <import>90</import> <list>90</list> <view>90</view> </Trd_TradeIns> </modules> ";
我想要從數組中的「模塊」標籤中檢索模塊,並且數組必須包含每個模塊的子標籤。請提出一些解決方案。
另一個實施例http://stackoverflow.com/questions/9781568/update-data-in-java-class-as-per-change-in-attribute-in-the-xml-file/9783154# 9783154 – 2012-03-29 07:16:57
謝謝[Riddhish.Chaudhari] [1] [1]:http://stackoverflow.com/users/1236051/riddhish-chaudhari – 2013-05-06 10:02:27