title: JAXB Unmarshaller returning null in object after parsing from XML
body: <p>I have a String object with xml data in it .
  I want that data in POJO , i tried using JAXB unmarshaller to convert but it always give me null values in the object attributes.</p>
  
  <p>this is my code :</p>
  
  <pre><code>ResponseEntity&lt;String&gt; response = restTemplate.getForEntity("https://api.flickr.com/services/rest/?api_key=MY_API_KEY&amp;method=flickr.photos.search&amp;tags=nature", String.class);    
  String resp = response.getBody();
  
  JAXBContext jaxBcontext = JAXBContext.newInstance(Resp.class);
  Unmarshaller unmarshaller = jaxBcontext.createUnmarshaller();
  Resp respObj = (Resp)unmarshaller.unmarshal(new StringReader(resp));
  </code></pre>
  
  <p>the value in String is :</p>
  
  <pre><code> &lt;rsp stat="ok"&gt;
   &lt;photos page="1" pages="4226" perpage="100" total="422597"&gt;
   &lt;photo id="28534349567" owner="79805131@N08" secret="b8bd7fe7cb" 
   server="843" farm="1" title="Savoie S006." ispublic="1" isfriend="0" 
   isfamily="0"/&gt;
   &lt;photo id="43355895332" owner="155237230@N05" secret="75fd48d040" 
   server="1769" farm="2" title="IMG_3139" ispublic="1" isfriend="0" 
   isfamily="0"/&gt;
   &lt;photo id="41595746070" owner="125407841@N08" secret="1f216ab8b8" 
   server="1822" farm="2" title="" ispublic="1" isfriend="0" isfamily="0"/&gt;
   &lt;/photos&gt;
   &lt;/rsp&gt;
  </code></pre>
  
  <p>the POJOS are :</p>
  
  <pre><code> @XmlAccessorType(XmlAccessType.FIELD)
   @XmlRootElement(name = "rsp")
   public class Resp {
  
      @XmlElement(name="stat")
      private String stat;
  
      @XmlElement(name="photos" , type = Photos.class)
      private Photos photos;
  
      public String getStat() {
          return stat;
      }
      //constructors and getter setters
  </code></pre>
  
  <hr>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlRootElement(name = "photos")
  public class Photos {
  
      @XmlElement(name="total")
      private String total;
  
      @XmlElement(name="page")
      private String page;
  
      @XmlElement(name="pages")
      private String pages;
  
      @XmlElement(name="perpage")
      private String perpage;
  
      @XmlElement(name="photo" , type=Photo.class)
      private List&lt;Photo&gt; photoObject = new ArrayList&lt;Photo&gt;();
  
      // constructors and getter setters.
  </code></pre>
  
  <hr>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlRootElement(name = "photo")
  public class Photo {
  
      @XmlElement(name="id")
      private String id;
  
      @XmlElement(name="isfamily")
      private String isfamily;
  
      @XmlElement(name="title")
      private String title;
  
      @XmlElement(name="ispublic")
      private String ispublic;
  
      @XmlElement(name="owner")
      private String owner;
  
      @XmlElement(name="secret")
      private String secret;
  
      @XmlElement(name="server")
      private String server;
  
      @XmlElement(name="isfriend")
      private String isfriend;
  
      // constructors and setter getter
  </code></pre>
  
  <p>the response i get is null values in all these objects.</p>
  
  <p>Resp [stat=null, photos=Photos [total=null, page=null, pages=null, 
     perpage=null, photo=]]</p>
  
  <p>the value in String which i get is absolutely correct , but when i try to map my data to a POJO it starts giving error.</p>
  
  <p>Other approach I used it to get the data directly in the object , like I have mentioned in my other question , but it also have some issues in that.</p>
  
  <p><a href="https://stackoverflow.com/questions/51337480/resttemplate-returns-data-in-string-but-not-populate-list-nested-objects">RestTemplate returns data in String but not populate list nested objects</a></p>
  
  <p>if anyone can help in either one of these that'd be helpful.</p>