Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6240135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:30:46+00:00 2026-05-24T11:30:46+00:00

I have this data structure: <estates version=0.1> <provider name=Foo> <estate id=12345678> <description>aaa</description> <size>300</size> </estate>

  • 0

I have this data structure:

<estates version="0.1">

 <provider name="Foo">
  <estate id="12345678">
   <description>aaa</description>
   <size>300</size>
  </estate>
  <estate id="12345679">
   <description>bbb</description>
   <size>450</size>
  </estate>
 </provider>

 <provider name="Bar">
  <estate id="987654321">
   <description>yyy</description>
   <size>100</size>
  </estate>
  <estate id="987654320">
   <description>zzz</description>
   <size>240</size>
  </estate>
 </provider>

</estates>

which I get from a web service of mine.
I would like to instantiate Android “Estates”, “Provider”, and “Estate” classes, using simple-xml library.

Class Estates.java:

@Root
public class Estates {
   @ElementList
   private List<Estate> providers;

   @Attribute
   private String version;
}

Class Estate.java:

public class Estate { 
   @Attribute
   private String id;

   @Element(required=false)
   private String description;

   @Element(required=false)
   private Integers size;
}

I.e., I use an @ElementList (List&lt;Estate&gt; providers) for the providers, but this way I can only use one provider list (having two lists, as in my example, gives:

“ERROR/com.simplexml.XmlActivity(4266): Uncaught exception: org.simpleframework.xml.core.PersistenceException: Element ‘providers’ declared twice at line 1”).

More, I can’t get “name” attribute. In practice, I suppose I have to dismiss the “List<Estate> providers” approach, but how to replace it? Should I use a “Collection”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:30:47+00:00Added an answer on May 24, 2026 at 11:30 am

    Note that simple-xml also allows you to set up the POJOs in such a way as to allow you to have the list in-line. On other words, you can do away with the <providersList> element and still the array of <provider>s will be recognizable.

    This is important when you have no control over the structure of the XML being received. In your case, if you stuck to the XML definition as per the original question, you would annotate it thus:

    @ElementList(inline=true)
       private List<Estate> providers;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this data structure (basically): (setq ssm-list '(tasklist ((id . 10525295) (name .
I'm using PostgreSQL 9.1 and I have this data structure: A B ------- 1
i have data structure i am passing this from server to client using data
Using EF4 and Linq I have a data structure which looks like this: parentid
I have this data from a xml file: <?xml version=1.0 encoding=utf-8 ?> <words> <id>...</id>
I have this data in a table, for instance, id name parent parent_id 1
I have this data structure: request ======= building_id lot_code building ======== building_id lot_id lot
I have a data structure that looks like this: data =[ {'key_1': { 'calc1':
I have this html structure: <div id=home> <div class=section_header> <h1 class=left data-target=newest><?=lang('home_newest');?></h1> ... </div>
I have this table/data structure: ID Area Postcode ------------------------ 1 Area 1 EN1 1NE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.