title: Deserialize flat array in XML by Jackson to List of Pojo
body: <p>can you help me to parse following XML file?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;dataset xmlns="http:/foo.com"&gt;
     &lt;date&gt;2017-10-25T09:13:54+02:00&lt;/date&gt;
     &lt;element&gt;
        &lt;id&gt;1&lt;/id&gt;
        &lt;name&gt;Stuart&lt;/name&gt;
        &lt;age&gt;34&lt;/age&gt;
        &lt;regdate&gt;&lt;date&gt;2017-10-25T09:13:54+02:00&lt;/date&gt;&lt;/regdate&gt;
     &lt;/element&gt;
     &lt;element&gt;
        &lt;id&gt;2&lt;/id&gt;
        &lt;name&gt;Lora&lt;/name&gt;
        &lt;age&gt;12&lt;/age&gt;
        &lt;regdate&gt;&lt;date&gt;2017-10-25T09:13:54+02:00&lt;/date&gt;&lt;/regdate&gt;
     &lt;/element&gt;
     &lt;element&gt;
        &lt;id&gt;3&lt;/id&gt;
        &lt;name&gt;Ben&lt;/name&gt;
        &lt;age&gt;50&lt;/age&gt;
        &lt;regdate&gt;&lt;date&gt;2017-10-25T09:13:54+02:00&lt;/date&gt;&lt;/regdate&gt;
     &lt;/element&gt;
  &lt;/dataset &gt;
  </code></pre>
  
  <p>I tried to create pojo like this:</p>
  
  <pre><code>@Getter
  @Setter
  @JacksonXmlRootElement(localName = "element")
  public class ElementXML {
      @JacksonXmlProperty(localName = "id")
      private Long id;    
      @JacksonXmlProperty(localName = "name")
      private String name;
      @JacksonXmlProperty(localName = "age")
      private Long age;
      @JacksonXmlProperty(localName = "regdate")
      private LocalDateTime regdate;
  }
  </code></pre>
  
  <p>and parsing mechanism what I've used is here:</p>
  
  <pre><code>    XMLInputFactory f = XMLInputFactory.newFactory();
      File inputFile = new File("some path");
      XMLStreamReader sr = f.createXMLStreamReader(new FileInputStream(inputFile));
  
  
      ObjectMapper xmlMapper = new XmlMapper();
  </code></pre>
  
  <p>There I stuck because I don't know how to parse just element tags into List of my created pojo ElementXML. Do you have idea how to solve it? Thank you in advice.</p>
  
  <p>Edit Trace after eddited parsing by answers</p>
  
  <pre><code>com.fasterxml.jackson.databind.JsonMappingException: Expected END_ELEMENT, got event of type 1 (through reference chain: com.xml.Dataset["element"]-&gt;java.lang.Object[][1])
  
      at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:394)
      at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:365)
      at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:206)
      at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:21)
      at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
      at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:113)
      at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4013)
      at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2902)
      at com.xml.data.ParseXmlTest.test(ParseXmlTest.java:62)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
      at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
      at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
      at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
      at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
      at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
      at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67)
  Caused by: java.io.IOException: Expected END_ELEMENT, got event of type 1
      at com.fasterxml.jackson.dataformat.xml.deser.XmlTokenStream.skipEndElement(XmlTokenStream.java:190)
      at com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser.nextToken(FromXmlParser.java:584)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:283)
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
      at com.fasterxml.jackson.databind.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:195)
      ... 43 more
  </code></pre>