First off all I didn’t find better title for my question, so please update if you have some words.
What I am doing :
In current I am sending two request for this purpose(One for user validation, another for data, if user is authorised). But I want to use single request.
What I want :
I will send a request as POST method to server where server will send a XML as response depends on my request.
For example :
- I am sending user and password to server.
- Server authenticate that user.
-
If user authorised, server sends response xml as

-
If authentication failed, server sends response as

Problem I faced :
I am not able to handle XML data, actually not identify the xml data.
I am using android.sax parser and I created two parser classes for both type of xml response, But how can I identify which parser class should I use depends on response?
Update :
Here is my actual xml


So how can I parse it, using single parser?
I would use a data structure which allows for the parser to see if it has failed or not.
Example:
And in your parser, see if the response is false or not. This is based on the fact that your response from the webservice does not contain the response tag if its successful.
Here is an example of a parser, might need some tweaks before it can be used. It is only useful if you only get 1 employee in your response, otherwise you need to use a list.