An array was returned before XML innuendo was read, which would not solve the problem of data import; The next step is to write a Java class (like the Hibernatepojo Class), instantiate the object list store when reading XML, and then return, storing the data as an object, easy to manipulate ....
In fact, it is very simple to write an object, List.add (object) to List on the line,
Read acquisition Time type conversion (class name) listobject.get (0);
A simple example of a student class (in the graduation project is equivalent to Pojo)
Publicclass XSB {
privateintxh;
Private String XM;
publicint getxh () {
return XH;
}
publicvoid setxh (int xh) {
this. xh = XH;
}
Public String Getxm () {
return to XM;
}
publicvoid Setxm (String xm) {
this. xm = XM;
}
}
Main class:
Publicclass Test {
Public List<object> GetList () {
list<object> list = new arraylist<object> ();
XSB xs=New xsb ();
XS.SETXH (1);
XS.SETXM ("John");
List.add (XS);
XSB xs1=New xsb ();
XS1.SETXH (2);
XS1.SETXM ("Dick");
List.add (XS1);
return list;
}
publicstaticvoid Main (String[]args) {
list<object> listObject = new arraylist<object> ();
Test te=New test ();
Listobject=te.getlist ();
XSB xs= (XSB) listobject.get (1); Read the objects in the list
System.out.print (XS.GETXM ());
}
}