XML : Retrofit simpleXML Converter for nested arrays

I am having trouble figuring out how to create a POJO model for simplexml.

Say I have an xml that I want to extract data from that looks like this:

  <root>      <station>          <station>              <abbr>Abbr1</abbr>          </station>      </station>      <station>          <station>              <abbr>Abbr2</abbr>          </station>      </station>      <station>          <station>              <abbr>Abbr3</abbr>          </station>      </station>  </root>    

So basically I figured I have an array inside of an Array, So I coded my java model like this:

  @org.simpleframework.xml.Root(name="root")  public class Root {      @Element(name="stations")      public Stations stations;        @Element(name="station")      public Station[] station;        @Element(name="abbr")      public String abbr;      public class Stations{          public Station[] station;      }        public class Station{          public String abbr;      }  }    

I tried tweaking the annotations around, but I can't get this to work. I would really appreciate help on this, thank you.

No comments:

Post a Comment