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 8548165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:25:53+00:00 2026-06-11T13:25:53+00:00

I am using a XML parser and as result I get a ArrayList with

  • 0

I am using a XML parser and as result I get a ArrayList with my objects:

ArrayList <Datapoint> itemsList = parseXML();

One Datapoint object consists of the following Strings:

name: a
stateBased: b
mainNumber: c
dptID: d
groupadress: e
priority: f

I was already able to display all the objects with this code:

for(int i=0;i<itemsList.size();i++)
{
    item = itemsList.get(i);
    parsedData = parsedData + "----->\n";
    String name = parsedData + "Name: " + item.getName() + "\n";
    String stateBased = parsedData + "stateBased: " + item.getStateBased() + "\n";
    String mainNumber = parsedData + "mainNumber: " + item.getMainNumber() + "\n";
    String dptID = parsedData + "dptID: "+ item.getDptID() + "\n";
    String groupadress = parsedData + "Groupadress: "+ item.getGroupadress() + "\n";
    String priority = parsedData + "priority: "+ item.getPriority() + "\n";
}

It would be great to have for example 5 string arrays each as a object from my ArrayList including the strings shown above.

String [] Object 1 = {name = a, stateBased = b, dptID =c, ..}
String [] Object 2 = {name = d, stateBased = e, dptID =f, ..}
String [] Object 3 = {name = g, stateBased = h, dptID =i, ..}

But how can i programmatically create a StringArray with each iteration? Something like this:

for(int i=0;i<itemsList.size();i++)
{
    item = itemsList.get(i);
    String [] [i] = new String [itemsList.size()];
    //insert strings to the array
}

How can I realize this or what would be an alternative?

Thanks!

  • 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-06-11T13:25:54+00:00Added an answer on June 11, 2026 at 1:25 pm

    I could solve the problem using the following code:

    ArrayList <Datapoint> itemsList = parseXML();
    String[itemsList.size()][4] = new String();
    
    for(int i=0;i<itemsList.size();i++)
    {
         item = itemsList.get(i);      
         String [i] [0] = item.getName();
         String [i] [1] = item.getStateBased();
         String [i] [2] = item.getMainNumber();
         String [i] [3] = item.getGroupadress();
         String [i] [4] = item.getPriority();
    }
    

    And private static String[][] String = null; is defined as global variable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

NOT USING A XML PARSER I want to get the contents of the XML
I am using some XML parser to get some information from API, blah blah...
I'm using TouchXML to parse an XML-stream the following way: CXMLDocument *parser = [[CXMLDocument
I've got the following problem: I'm using the PHP XML DOM parser and when
Possible Duplicate: Best XML Parser for PHP Using JAXB with Google Android I need
I am begginer to android development. I am using SAX parser for xml parser.
In my application, I am parsing XML data using SAX Parser. But, I want
I am using DOM parser to parse xml data, but its taking lots of
I want to parse the xml file with dynamic content using DOM parser in
I have student.xml file and am parsing this file using SAX Parser and now

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.