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

  • Home
  • SEARCH
  • 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 8494897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:25:23+00:00 2026-06-10T23:25:23+00:00

just a simple question here. How can I get the return value on this

  • 0

just a simple question here. How can I get the return value on this kind of xml

 Art C. Cauyao<$@FBID@$>501912568<$@ENDFBID@$>Tessa Rose 
Brainard<$@FBID@$>510831686<$@ENDFBID@$>
Dan Gangan<$@FBID@$>513545777<$@ENDFBID@$>
C Jhec DawAko<$@FBID@$>523059320<$@ENDFBID@$>Jeremy 

Please see that I am getting Facebook name and Facebook ID
Is there any way about that?

EDIT

I found out that it is not an xml but rather A JSON (sorry) now my question really is how can I incorporate that returned value?

EDIT SECOND
Sir this what I am doing
Parsing it through this

static final String URL_FBFRIEND ="Some URL"+ "getFBFriends.php"; 

Now using that I can now parse some data by using my input values. Here is the code

        XMLparser parser2 = new XMLparser(); 
    parser2.getXmlFromUrl(URL_FBFRIEND); 

      //HTTP POST
      String url_Getmembermob= URL_FBFRIEND ;
      String xml_getMembermob=null;
      try {
      HttpClient httpclient = new DefaultHttpClient();
      HttpPost httppost = new HttpPost(url_Getmembermob);

      List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(4); 
      nameValuePairs.add(new BasicNameValuePair("...", "...."));
      nameValuePairs.add(new BasicNameValuePair("fbID", modGen.facebookID ));
      nameValuePairs.add(new BasicNameValuePair("accToken", modGen.tokenID));
      nameValuePairs.add(new BasicNameValuePair("reqType", "0"));

      Log.i("nameValuePairs", "nameValuePairs=" + nameValuePairs);

        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
        HttpResponse httpResponse = httpclient.execute(httppost);

        HttpEntity httpEntity = httpResponse.getEntity();

        xml_getMembermob = EntityUtils.toString(httpEntity);

        Log.i("xml-return",""+ xml_getMembermob);

    } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace(); 
    }catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

See that I am logging the returned xml Log.i(“xml-return”,””+ xml_getMembermob); And thats the output

Sir Ive altered your code`
public static List parseUserList(String userData)
{
List ret = new ArrayList();

    int index = 0;
    while (index < userData.length())
    {
        int startFbTag = userData.indexOf(FB_NAME, index);
        if (index == -1)
        {

            return ret;
        }
        String name = userData.substring(index, startFbTag - index);
        startFbTag += FB_NAME.length(); // Start of the actual data
        int endFbTag = userData.indexOf(FB_ID, startFbTag);
        if (endFbTag == -1)
        {
            throw new IllegalArgumentException("Unterminated start tag");
        }

        fbTagValue = userData.substring(startFbTag, endFbTag - startFbTag);
        Log.i("UserName",fbTagValue);
        //fbId = Long.parseLong(fbTagValue);
        //ret.add(new User(name, fbId));
        index = endFbTag + FB_ID.length();
    }
    return ret;
}

I am getting an error here ** fbTagValue = userData.substring(startFbTag, endFbTag – startFbTag);**
what seems to be the problem

  • 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-10T23:25:24+00:00Added an answer on June 10, 2026 at 11:25 pm

    This is pretty horrible format. It’s not XML. It’s not JSON. Assuming you’ve already got some sort of User class, and that all the data is in a single String, you could write something like this (completely untested):

    private static final String FB_START = "<$@FBID@$>";
    private static final String FB_END = "<$@ENDFBID@$>";
    
    public static List<User> parseUserList(String userData)
    {
        List<User> ret = new ArrayList<User>();
    
        int index = 0;
        while (index < userData.length())
        {
            int startFbTag = userData.indexOf(FB_START, index);
            if (index == -1)
            {
                // No tags left. You should check whether you've actually got
                // some data left, and potentially throw an exception. It's not
                // clear what your data format does here.
                return ret;
            }
            String name = userData.substring(index, startFbTag - index);
            startFbTag += FB_START.length(); // Start of the actual data
            int endFbTag = userData.indexOf(FB_END, startFbTag);
            if (endFbTag == -1)
            {
                throw new IllegalArgumentException("Unterminated start tag");
            }
    
            String fbTagValue = userData.substring(startFbTag, endFbTag - startFbTag);
            long fbId = Long.parseLong(fbTagValue);
            ret.add(new User(name, fbId));
            index = endFbTag + FB_END.length();
        }
        return ret;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im struggling with syntax here: hopefully this question is v simple, im just miising
Just a simple question, but can't get an answer on my own. In memory
Simple question, I just want to select the text from the <Template> tag. Here's
This is just a simple question. I was trying to create a new object
This is just a simple question. I've been reading the source of something which
This is just a simple question. Either way works. I prefer my first example,
I'm new to jquery and ajax - just can't seem to get this to
[This question is motivated by Chapter 9 in Real World Haskell] Here's a simple
This may be a fairly simple question, but I can't seem to find the
I just can't seem to figure this out. I found some similar Questions 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.