????person.setName(new String(element.getFirstChild().getNodeValue()));

????}elseif("age".equals(childNode.getNodeName())){

????person.setAge(new Short(element.getFirstChild().getNodeValue()));

????}

????}

????}

????pers.add(person);

????}

????inStream.close();

????return pers;

????}

????}

????(3)???Pull?????????XML???

????PullPerson.java

????import java.io.File;

????import java.io.FileOutputStream;

????import java.io.InputStream;

????import java.util.ArrayList;

????import java.util.List;

????import org.xmlpull.v1.XmlPullParser;

????import org.xmlpull.v1.XmlSerializer;

????import android.os.Environment;

????import android.util.Xml;

????import com.sinber.domain.Person;

????publicclass PullPerson {

????publicstaticvoid save(List persons) throws Exception{

????XmlSerializer serializer = Xml.newSerializer();

????File file =new File(Environment.getExternalStorageDirectory()??"person.xml");

????FileOutputStream outStream =new FileOutputStream(file);

????serializer.setOutput(outStream??"UTF-8");

????serializer.startDocument("UTF-8"?? true);

????serializer.startTag(""?? "persons");

????for(Person person:persons){

????serializer.startTag(""?? "person"); //person

????serializer.attribute(""?? "id"?? ""+person.getId());

????serializer.startTag(""?? "name"); //name

????serializer.text(person.getName());

????serializer.endTag(""?? "name"); //name

????serializer.startTag(""?? "age"); //age

????serializer.text(person.getAge().toString());

????serializer.endTag(""?? "age");//age

????serializer.endTag(""?? "person"); //person

????}

????serializer.endTag(""?? "persons");

????serializer.endDocument();

????outStream.close();

????}

????publicstatic List getPersons() throws Exception{

????List persons =null;

????Person person =null;

????XmlPullParser parser= Xml.newPullParser();

????InputStream inStream = PullPersonService.class.getClassLoader().getResourceAsStream("person.xml");

????parser.setInput(inStream?? "UTF-8");

????int eventType = parser.getEventType(); //????????????

????while(eventType!=XmlPullParser.END_DOCUMENT){

????switch(eventType){

????case XmlPullParser.START_DOCUMENT:

????persons =new ArrayList();

????break;

????case XmlPullParser.START_TAG: //?????????

????if("person".equals(parser.getName())){

????person =new Person();

????person.setId(new Integer(parser.getAttributeValue(0)));

????}elseif(person!=null){

????if("name".equals(parser.getName())){

????person.setName(parser.nextText());

????}elseif("age".equals(parser.getName())){

????person.setAge(new Short(parser.nextText()));

????}

????}

????break;

????case XmlPullParser.END_TAG: //??????????

????if("person".equals(parser.getName())){

????persons.add(person);

????person =null;

????}

????break;

????default:

????break;

????}

????eventType = parser.next();

????}

????return persons;

????}

????}

???????????????????????ɡ?

????9.??????????????????Android?????????

??????(1)???е???ó???????????????飬Android???????????????????????ó???

????(2)Android??????????????????????????????????????????????????????????

????(3)??????????????Android ?????????????????????????????????????????????????????adt???????ant???????????????????????

????(4)??????鶼??????Ч????Android???????ó???????????????????Ч?????????????????????У???????????????????????????????

????10.?????????????head??д????????????????????

?????? ???????

????Node.java

????publicclass Node {

????private Integer count;

????private Node nextNode;

????public Node(){

????}

????public Node(int count){

????this.count =new Integer(count);

????}

????public Integer getCount() {

????return count;

????}

????publicvoid setCount(Integer count) {