public void serialize(KXmlSerializer serializer) throws IOException {
  mDeviceInfo.serialize(serializer);
  serializeHostInfo(serializer);
  serializeTestSummary(serializer);
  monkeyTag.serialize(serializer);
  List<TestPackageResult> pkgs=new ArrayList<TestPackageResult>(mPackageMap.values());
  Collections.sort(pkgs,new PkgComparator());
  for (  TestPackageResult r : pkgs) {
    r.serialize(serializer);
  }
}

public void serialize ( KXmlSerializer serializer ) throws IOException { mDeviceInfo . serialize ( serializer ) ; serializeHostInfo ( serializer ) ; serializeTestSummary ( serializer ) ; monkeyTag . serialize ( serializer ) ; List < TestPackageResult > pkgs = new ArrayList < TestPackageResult > ( mPackageMap . values ( ) ) ; Collections . sort ( pkgs , new PkgComparator ( ) ) ; for ( TestPackageResult r : pkgs ) { r . serialize ( serializer ) ; } }
serialize the test results to xml .
