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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:36:28+00:00 2026-06-11T15:36:28+00:00

I have trapped in some strange issue and I am not able to figure

  • 0

I have trapped in some strange issue and I am not able to figure it out that what i am doing wrong. I have one screen where UserInfo is being displayed.For that i am getting the XML when i fired the webservice and i parse that data and display it which works well in 2.3.3 but failed to parse in ICS .

Here is my way to parse the data ::

XML ::

<?xml version="1.0"?>
<root>
 <displayname>AAAA</displayname>
 <gender>male</gender>
 <city>AAAA</city>
 <state>AAAA</state>
 <country>AAA</country>
 <image>http://www.example.com/documentSetting/test.jpg</image>
</root>

My AsyncTask ::

private class GetUserInfoTask extends AsyncTask<String, Integer, Document> 
{
    Document document = null;

    GetUserInfoTask()
    {
        webAPIRequest = new WebAPIRequest();
    }

    @Override
    protected Document doInBackground(String... urls) 
    {
        document = webAPIRequest.performGet(urls[0]);

        return document;
    }

    protected void onPostExecute(Document result) 
    {
        try
        {
            if(result!=null)
            {
                Element node = (Element)result.getElementsByTagName("root").item(0);

                if(node!=null)
                {
                    websiteList = node.getElementsByTagName("root");
                    check = websiteList.getLength();

                    if(check!=0)
                    {
                        arrUserInfoList=null;
                        if(arrUserInfoList==null)
                        {
                            arrUserInfoList = new ArrayList<UserProfile>();
                        }

                        for(int j=0;j<websiteList.getLength();j++)

                        {                               
                            Element checkNode=(Element)websiteList.item(j);
                            UserProfile user=new UserProfile(); 

                            msg.display_name = getValueFromNode(checkNode,"displayname");
                            msg.gender = getValueFromNode(checkNode,"gender");
                            user.city = getValueFromNode(checkNode,"city");
                            user.state = getValueFromNode(checkNode,"state");
                            user.country = getValueFromNode(checkNode,"country");
                            user.image = getValueFromNode(checkNode,"image");

                            arrUserInfoList.add(user);
                        }

                        txt_user_name_top.setText(arrUserInfoList.get(0).displayname);
                        txt_user_gender.setText(arrUserInfoList.get(0).gender);
                        txt_user_status.setText(arrUserInfoList.get(0).status);
                        txt_user_country.setText(arrUserInfoList.get(0).country);
                        txt_user_country.setText(arrUserInfoList.get(0).city);

                    }

                }
                new LoadingFriendImagesTask().execute();
            }
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
    }
 }

My PerformGet Method ::

public Document performGet(String url) 
{
    Log.d("webAPIRequest url = ", url);
    Document doc = null;
    try 
    {
        DefaultHttpClient client = new DefaultHttpClient();

        URI uri = new URI(url);
        HttpGet method = new HttpGet(uri);
        HttpResponse res = client.execute(method);
        InputStream data = res.getEntity().getContent();
        String s =  convertStreamToString(data);
        ByteArrayInputStream str=new ByteArrayInputStream(s.getBytes());
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();

        doc = db.parse(str);

    }
    catch (ClientProtocolException e) 
    {
         e.printStackTrace();
    }   
    catch (IOException e) 
    {
        e.printStackTrace();
    }
    catch (URISyntaxException e)
    {
        e.printStackTrace();
    } 
    catch (ParserConfigurationException e) 
    {
        e.printStackTrace();
    } 
    catch (SAXException e) 
    {
        e.printStackTrace();
    }

    return doc;
}

Your valuable suggestions and help will be appreciated …
Thanks in Advance … 🙂

  • 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-11T15:36:29+00:00Added an answer on June 11, 2026 at 3:36 pm

    I have solved my problem like this.

    I have replaced this code …

    else
    {
    node = (Element)result.getElementsByTagName("root").item(0);
    
    if(node!=null)
    {
        websiteList = node.getElementsByTagName("root");
        check = websiteList.getLength();
    
        if(check!=0)
        {
            if(arrUserInfoList==null)
            {
                arrUserInfoList = new ArrayList<UserProfile>();
            }
    
            for(int j=0;j<websiteList.getLength();j++)
            {                           
            }
        }
    }
    }
    

    with this ::

    else
    {
    websiteList = (NodeList)document.getElementsByTagName("root");
    check = websiteList.getLength();
    
    if(check!=0)
    {
        if(arrUserInfoList==null)
        {
            arrUserInfoList = new ArrayList<UserProfile>();
        }
    
        for(int j=0;j<websiteList.getLength();j++)
        {
        }
    }
    }
    

    This gonna worked for me like a charm .. 🙂

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

Sidebar

Related Questions

I have set up some gesture recognition in an app that I'm building. One
I am trapped in one problem. I have a page which contains some taxboxes.
I have a bash script that mounts and unmounts a device, which performing some
I have implemented some code that will automatically set a UIScrollView's ContentOffset when the
I have received comments from blind users that some of my sound and music
Anyone have some sample code for an in-app browser that they would like to
We have some code that was generated, mostly likely by svcutil from an XML
I have a TableViewController on my storyboard that has some cells (static) that I
I have a subclassed UITableViewController that performs some animations when editing mode is entered,
I have a MKMapView in one of my views with some annotations on it.

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.