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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:03:40+00:00 2026-05-24T08:03:40+00:00

I am receiving a response from a XML request and I need to deal

  • 0

I am receiving a response from a XML request and I need to deal with it. The response will return either ’00’ when the request has been accepted and the account is verified and a ’03’ when the account is invalid.

Currently the Sax Reader is returning the correct information but I cannot extract the information from the reader so I can store the username / password into the internal storage of the phone.

The code from the Sax Reader is:

public void inputStreamToString(InputStream is) {
        try {
            SAXParserFactory factory = SAXParserFactory.newInstance();
            SAXParser saxParser = factory.newSAXParser();

            DefaultHandler handler = new DefaultHandler() {

                boolean errorCode = false;

                public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException 
                {
                    System.out.println("Start Element :" + qName);

                    if (qName.equalsIgnoreCase("ErrorCode")) 
                    {
                        errorCode = true;
                    }
                }

                public void endElement(String uri, String localName,String qName) throws SAXException 
                {
                    System.out.println("End Element :" + qName);
                }

                public void characters(char ch[], int start, int length) throws SAXException 
                {
                    if (errorCode) 
                    {
                        System.out.println("ErrorCode : "+ new String(ch, start, length));
                        if (ch.equals(00))
                        {
                            System.out.println("IT WORKS!!!");
                        }
                        errorCode = false;
                    }
                }
            };
            saxParser.parse(is, handler);
        } 
        catch (Exception e) 
        {
            System.out.println("Sax Error");
            e.printStackTrace();
        }       
    }

As you can see in the public void characters it is printing out the errorcode that is relevant from the response. I am currently trying to do ch.equals(00) in a If statement but it isn’t picking out the correct information! Could it be a problem that ch is a char data type?

Any help will be appreciated.

  • 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-24T08:03:41+00:00Added an answer on May 24, 2026 at 8:03 am

    I got it working. Instead of using ’00’ and ’03’ error codes. I have used the length of the response messages which are ‘OK’ and ‘Invalid’.

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

Sidebar

Related Questions

I am sending a request to webservice and am receiving correct response from web
I am receiving an XML response from an API in a variable r so
I'm receiving some response from JSON , and is working fine, but I need
I have a scenario where we are receiving in xml messages. I need to
Documentation states that 'handleResponseEnd' is called when the response has been completely received. http://twistedmatrix.com/documents/11.0.0/api/twisted.web.http.HTTPClient.html#handleResponseEnd
I'm pulling a response from an API and receiving: response: job: unit_count: 1 slug:
I have been trying to send xml message from php to asp and output
I am receiving a JSON response from our server and it is compressed using
I'm receiving a JSON response from a web service, but for various reasons I
is it possible to upload a file and subsequently when receiving response download the

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.