import java.util.*;
public class SetValue {
private String property;
private ArrayList list;
public SetValue(String property,ArrayList list)
{
this.property=property;
this.list=list;
}
public String getproperty()
{
return property;
}
public ArrayList getArray()
{
return list;
}
}.
import java.util.*;
import org.w3c.dom.*;
public class Test {
private static String proter;
private static ArrayList list;
//private static HashMap hm=new HashMap();
private static ArrayList
public static ArrayList getHistory()
{
Document xml=XMLFile.XMLPath();//獲得XML解析路徑
Element root=xml.getDocumentElement();//得到根節點
NodeList ndlist=root.getElementsByTagName("node");
for(int i=0;i
proter=ndlist.item(i).getAttributes().getNamedItem("property").getNodeValue();
Element element=(Element)ndlist.item(i);
NodeList nd2list=element.getElementsByTagName("value");
list=new ArrayList();
for(int j=0;j
String s=nd2list.item(j).getFirstChild().getNodeValue();
list.add(s);
}
SetValue sv=new SetValue(proter,list);
ss.add(sv);
}
return ss;
}
public static void main(String[] args)
{
ArrayList gh=getHistory();
for(int k=0;k
SetValue st=(SetValue)gh.get(k);
System.out.println(st.getproperty());
System.out.println(st.getArray());
}
}
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7739550/viewspace-431715/ ,如需转载,请注明出处,否则将追究法律责任。