title: Android speed issue with deserialization using SimpleXML
body: <p>Raised a bounty as the only answer doesn't provide a good implementation for Android. Is there a speedier implementation compatible with Android? Or is SimpleXML the best performance I'll get?</p>
  
  <p>I'm fairly novice to Java and Android development so don't know the proper procedure for deserializing an xml string to an object. I found a method that works in:</p>
  
  <pre><code>public static Object deserializeXMLToObject(String xmlFile,Object objClass)  throws Exception 
  { 
      try
      {
              InputStream stream = new ByteArrayInputStream(xmlFile.getBytes("UTF-8"));
  
              Serializer serializer = new Persister();
              objClass = serializer.read(objClass, stream);
              return objClass;
      }
      catch (Exception e) 
      {
          return e;
      }
  }
  </code></pre>
  
  <p>Where <code>xmlFile</code> is the (misnamed) xml string, and <code>objClass</code> is an empty class of the class I want to deserialize to. This is generally a list of other objects.</p>
  
  <p>Example class:</p>
  
  <pre><code>@Root(name="DepartmentList")
  public class DepartmentList {
      @ElementList(entry="Department", inline=true)
      public List&lt;Department&gt; DepartmentList =new ArrayList&lt;Department&gt;();
      public boolean FinishedPopulating = false;
  }
  </code></pre>
  
  <p>Department class:</p>
  
  <pre><code>public class Department {
  
      @Element(name="DeptID")
      private String _DeptID ="";
      public String DeptID()
      {
          return _DeptID;
      }
      public void DeptID(String Value)
      {
          _DeptID = Value;
      }
  
      @Element(name="DeptDescription")
      private String _DeptDescription ="";
      public String DeptDescription()
      {
          return _DeptDescription;
      }
      public void DeptDescription(String Value)
      {
          _DeptDescription = Value;
      }
  }
  </code></pre>
  
  <p>Example XML:</p>
  
  <pre><code>&lt;DepartmentList&gt;
    &lt;Department&gt;
      &lt;DeptID&gt;525&lt;/DeptID&gt;
      &lt;DeptDescription&gt;Dept 1&lt;/DeptDescription&gt;
    &lt;/Department&gt;
    &lt;Department&gt;
      &lt;DeptID&gt;382&lt;/DeptID&gt;
      &lt;DeptDescription&gt;Dept 2&lt;/DeptDescription&gt;
    &lt;/Department&gt;
  &lt;/DepartmentList&gt;
  </code></pre>
  
  <p>This has been working fine throughout the app, but I have come to a point where it needs to deserialise >300 objects in the list. This only takes approximately 5 secs, or close to a minute when debugging, but users are not happy with that performance and time wasted when debugging isn't desirable. Is there any way to speed this up? Or is there another way I should be doing this? Preferably only by changing the <code>deserializeXMLToObject</code> method.</p>