title: Using Jackson XML Mapper to get a list
body: <p>I currently am working with Jackson to read an XML file from an online location, map it to an object and then insert that object into MongoDB using the Object Mapper.</p>
  
  <p>At the moment my dataset looks something like this:</p>
  
  <pre><code>&lt;sensors&gt;
      &lt;sensor id="000" name="Sensor Name" refreshRate="2000"&gt;
          &lt;location latitude="12.3456" longitude="-67.890"/&gt;
      &lt;/sensor&gt;
  &lt;sensor id="000" name="Sensor Name" refreshRate="2000"&gt;
          &lt;location latitude="12.3456" longitude="-67.890"/&gt;
      &lt;/sensor&gt;
  &lt;/sensors&gt;
  </code></pre>
  
  <p>If I do the following:</p>
  
  <p>List entries = xmlMapper.readValue(conn.getInputStream(), List.class); </p>
  
  <p>I get back a list of LinkedHashMap that contain the items.  However, I would much prefer if I could just map this back to my Sensor Class that I've already created.</p>
  
  <p>This sensor class is the one I use when interacting with Mongo and it looks something like this:</p>
  
  <pre><code>@Document(collection = "Sensor")
  @JsonIgnoreProperties(ignoreUnknown = true)
  @JacksonXmlRootElement(localName="sensors")
  public class Sensor {
  
      @Id
      private int id;
  
      String name = "";
      long refreshRate = "";
      Location location;
  
      ...
  }
  </code></pre>
  
  <p>I've tried casting or mapping to Sensor; however, that doesn't work.  What is the missing step?  All documentation and tutorials I read up on only seem to handle simple instances of a single entry.</p>