How to use Retrofit and SimpleXML together in downloading and parsing an XML file from a site?

前端 未结 3 1879
有刺的猬
有刺的猬 2020-12-02 16:04

I just started working with Retrofit. I am working on a project that uses SimpleXML. Can somebody provide me an example in which one fetches an XML from a site e.g. http://w

3条回答
  •  忘掉有多难
    2020-12-02 16:31

    import java.util.ArrayList;
    import java.util.List;
    
    import org.simpleframework.xml.ElementList;
    import org.simpleframework.xml.Root;
    
    @Root(name = "breakfast_menu")
    public class BrakfastMenu
      {
        @ElementList(inline = true)
        protected List food;
    
        public List getConfigurations()
          {
            if (food == null)
              {
                food = new ArrayList();
              }
            return this.food;
          }
    
        public void setConfigurations(List configuration)
          {
            this.food = configuration;
          }
    
      }
    

提交回复
热议问题