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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:55:20+00:00 2026-05-29T21:55:20+00:00

Here is my code: (source: http://www.androidhive.info/2011/11/android-xml-parsing-tutorial/ ) Here is my XML file: removed On

  • 0

Here is my code: (source: http://www.androidhive.info/2011/11/android-xml-parsing-tutorial/)

Here is my XML file: removed

On run, the NoResults appears and I get the string “h1” which isn’t a xml tag in my file.
I am not sure if my xml file is being converted incorrectly or I can’t successfully find the “members” tag.

    ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();

    XMLParser parse = new XMLParser();
    String xml = parse.getXmlFromUrl(url); // getting XML
    Document doc = parse.getDomElement(xml); // getting DOM element

    NodeList nodes = doc.getElementsByTagName(KEY_MEMBER);

    // looping through all item nodes <member>
    for (int i = 0; i < nodes.getLength(); i++) {                           
        HashMap<String, String> map = new HashMap<String, String>();    

        Element e = (Element)nodes.item(i);
        map.put(KEY_FNAME, parse.getValue(e, KEY_FNAME));
        map.put(KEY_MNAME, parse.getValue(e, KEY_MNAME));
        map.put(KEY_LNAME, parse.getValue(e, KEY_LNAME));
        map.put(KEY_STATE, parse.getValue(e, KEY_STATE));
        map.put(KEY_PARTY, parse.getValue(e, KEY_PARTY));
        mylist.add(map);            
    }

    if((nodes.getLength() <= 0)){
            Toast.makeText(AndroidXMLParsingActivity.this, "NoResults " + doc.getDocumentElement().getNodeName(), Toast.LENGTH_LONG).show();
            finish();
    }
  • 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-29T21:55:22+00:00Added an answer on May 29, 2026 at 9:55 pm

    Since “h1” is an html tag, i would guess that the url your are hitting is returning html, not xml. an easy way to determine this, of course, would be to print out the xml string before you parse it.

    fyi, not sure about the limitations of coding on android, but it’s generally a bad idea to convert an xml document to string before you parse it (for a variety of reasons ranging from “breaking” the xml to needlessly increasing the memory usage).

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

Sidebar

Related Questions

Given the code block below (source: http://www.asp.net/learn/mvc/tutorial-31-cs.aspx )... I receive this error: Using the
In source code here http://www.daftlogic.com/sandbox-javascript-slider-control.htm There is these instructions: // safely hook document/window events
Download source code here: http://www.eyeClaxton.com/download/delphi/ColorSwap.zip Yes, I want to convert something mostly blue to
Check out the source code here: http://www.savvissl.com/demo1/showcode.php check out the script here http://www.savvissl.com/demo1/testPDF.php Here
I have AJAX call to one XML file and the source code is given
I downloaded the STL source code from http://www.sgi.com/tech/stl/download.html , but it only has the
http://www.helloandroid.com/tutorials/how-use-canvas-your-android-apps-part-1 At the end of this tutorial link for source code download is available.
you can view full source code here dpaste.com/hold/167199 Error: delete() takes exactly 2 arguments
I have an application I need to analyze. I have the source code here.
I am trying to install MySQLdb package. I found the source code here .

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.