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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:07:10+00:00 2026-06-14T08:07:10+00:00

Hi im very new to webserices and xml parsing.I use http://www.mysamplecode.com/2011/11/android-parse-xml-file-example-using.html this link as

  • 0

Hi im very new to webserices and xml parsing.I use http://www.mysamplecode.com/2011/11/android-parse-xml-file-example-using.html this link as my reference.
But i think in this link the xml is a simple one.How can i parse a complex xml like this one.Can any one suggest me a method to parse this. I want to read the values of < A >,< B >,< C >,< D > tags from each MenuEntry

        <Menu>
         <MenuEntries>

           <MenuEntry>
           <A>--AAAAA---</A>
           <B>--BBBB---</B>
           <MenuEntries/>
           <C>--CCCC---</C>
           <D>--DDDD---</D>
           </MenuEntry>

            <MenuEntry>
            <B>--BBBB---</B>
            <menuEntries/>
            <C>--CCCC---</C>
            <D>--DDDD---</D>
            </MenuEntry>

            <MenuEntry>
            <A>--AAAAA---</A>
            <B>--BBBB---</B>
             <MenuEntries>

                <MenuEntry>
                <A>--AAAAA---</A>
                <B>--BBBB---</B>
                <MenuEntries/>
                <C>--CCCC---</C>
                <D>--DDDD---</D>
                </MenuEntry>

                <MenuEntry>
                <A>--AAAAA---</A>
                <B>--BBBB---</B>
                <MenuEntries/>
                <C>--CCCC---</C>
                <D>--DDDD---</D>
                </MenuEntry>

             </MenuEntries>
           <C>--CCCC---</C>
           <D>--DDDD---</D>
             </MenuEntry>

        <MenuEntry>
        <B>--BBBB---</B>
        <MenuEntries/>
        <C>--CCCC---</C>
        <D>--DDDD---</D>
          </MenuEntry>

        <MenuEntry>
        <A>--AAAAA---</A>
        <B>--BBBB---</B>
        <MenuEntries>

            <MenuEntry>
            <A>--AAAAA---</A>
            <B>--BBBB---</B>
            <MenuEntries/>
            <C>--CCCC---</C>
            <D>--DDDD---</D>
            </MenuEntry>

        </MenuEntries>
        <C>--CCCC---</C>
        <D>--DDDD---</D>
          </MenuEntry>

        </MenuEntries>
        </Menu>

This is my xmlHandler class for parsing the xml

    public class ItemXMLHandler extends DefaultHandler {

        Boolean currentElement = false;
        String currentValue = "";
        Menu item = null;
         static ArrayList<Menu> menuList = new ArrayList<Menu>();

        public static ArrayList<Menu> getMenuListz() {

            Log.e("in getMenulist()", String.valueOf(menuList.size()));
            return menuList;
        }

        // Called when tag starts
        @Override
        public void startElement(String uri, String localName, String qName,
                Attributes attributes) throws SAXException {

            currentElement = true;
            currentValue = "";
            if (localName.equals("MenuEntry")) {
                //Log.e("menuENtry found ", "menuENtry found");
                item = new Menu();

            }

        }

        @Override
        public void endElement(String uri, String localName, String qName)
                throws SAXException {

            currentElement = false;

            /** set value */
            if (localName.equalsIgnoreCase("A")) {
                item.setA(currentValue);
            } else if (localName.equalsIgnoreCase("B")) {
                item.setB(Long.parseLong(currentValue));
            } else if (localName.equalsIgnoreCase("C")) {
                    item.setC(currentValue);
            } else if (localName.equalsIgnoreCase("menuEntry"))

                menuList.add(item);

        }

        // Called to get tag characters
        @Override
        public void characters(char[] ch, int start, int length)
                throws SAXException {

            if (currentElement) {
                currentValue = currentValue + new String(ch, start, length);
            }

        }

    }

This is my java class for Menu

    public Class Menu{
        private long B;
        private String A;
        private String C;

        public long getB() {
            return B;
        }
        public void setB(long B){
            this.B = B;
        }
        public String getA() {
            return A
        }
        public void setA(String A){
            this.A = A
        }
        public String getC() {
            return C
        }
        public void setC(String C) {
            this.C = C;
        }
    }

Im getting duplications and null values.I know my coding could be wrong can any one help me with a reply or any useful links for parsing this kind of complex xml ( for me its complex 🙂 )

  • 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-14T08:07:11+00:00Added an answer on June 14, 2026 at 8:07 am

    http://simple.sourceforge.net/ helped me in parsing this xml

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

Sidebar

Related Questions

Im very new in C++ I have found this post http://msdn.microsoft.com/en-us/magazine/cc163486.aspx and trying to
Very new to XSL (and XML for that matter), but I need to step
Hi I'm very new to XML, and webservices but I'm recieving XML from a
I'm going to do a wpf application using MVVM(It based on http://www.codeproject.com/KB/WPF/MVVMQuickTutorial.aspx ). This
Am very new to Android apps development. In my new Android app i want
I'm very new to webservices. Currently i'm working on an android app which needs
We are trying to consume webservices in blackberry.We are very new in developing apps
Very new to python and can't understand why this isn't working. I have a
Very new to C++ and Cocos2d-x but I was just toying around with CCArray
Very new to javascript and html-type stuff. I wanted to just make a quick

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.