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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:24:32+00:00 2026-06-17T10:24:32+00:00

I am not able to extract url from the data i am recieving. Data

  • 0

I am not able to extract url from the data i am recieving.

Data is

<ASX VERSION="3.0"><TITLE>iROCK109 - Classic Rock And More!</TITLE><MOREINFO HREF="http://www.irock109.com/" /><COPYRIGHT>� iROCK109 - 2009</COPYRIGHT><ABSTRACT>Classic Rock n More!</ABSTRACT><ENTRY><TITLE>[128k] www.irock109.com</TITLE><REF HREF="http://cp6.digistream.info:20366/" /><AUTHOR>iROCK 109 - Classic Rock And More!</AUTHOR><ABSTRACT>DJ Hosted Classic Rock 60s through today, and requests 24/7</ABSTRACT>

and the code i am using is to read data and exrtrat HREF from REF is

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        try {
            executeHttpGet();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
        //Method for http request

        public void executeHttpGet() throws Exception {

            BufferedReader in = null;

            try {

                System.out.println("ndkjsdak");
                HttpClient client = new DefaultHttpClient();
                HttpGet request = new HttpGet();

                HttpProtocolParams.setUseExpectContinue(client.getParams(), false);


                request.setURI(new URI("http://www.irock109.com/streams/irock109-128mp3.asx"));

                //HttpResponse response = client.execute(request);

                HttpResponse response = null;

                boolean RetryConnection = true;
                int retrycount = 0;

                //retry request 5 times
                while(RetryConnection == true && retrycount < 5)
                {
                    try
                    {
                         response = client.execute(request);
                         RetryConnection = false;
                    }
                    catch(IOException e)
                    {
                        System.out.println("caught");
                        retrycount += 1;
                    }
                }

                in = new BufferedReader
                (new InputStreamReader(response.getEntity().getContent()));

                StringBuffer sb = new StringBuffer("");
                String line = "";
                String NL = System.getProperty("line.separator");

                while ((line = in.readLine()) != null)
                {
                    sb.append(line +NL);
                }
                in.close();
                String page=sb.toString();
                System.out.println("xml data "+page);

                XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
                 factory.setNamespaceAware(true);
                 XmlPullParser xpp = factory.newPullParser();

                 xpp.setInput( new StringReader (page) );
                 int eventType = xpp.getEventType();
                 while (eventType != XmlPullParser.END_DOCUMENT)
                 {
                  if(eventType == XmlPullParser.START_DOCUMENT)
                  {
                      System.out.println("Start document");
                  }
                  else if(eventType == XmlPullParser.START_TAG)
                  {
                      System.out.println("Start tag "+xpp.getName());
                  }
                   else if(eventType == XmlPullParser.END_TAG)
                  {
                      System.out.println("End tag "+xpp.getName());
                  }
                  else if(eventType == XmlPullParser.TEXT) 
                  {
                      System.out.println("Text "+xpp.getText());
                  }
                  eventType = xpp.next();
                 }
                 System.out.println("End document");
            }
            finally 
            {
                if (in != null) 
                {
                    try
                    {
                        in.close();
                    } 
                    catch (IOException e)
                        {
                        e.printStackTrace();
                    }
                }
            }
    }
}

How can I get the href from ref?

  • 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-17T10:24:33+00:00Added an answer on June 17, 2026 at 10:24 am

    Try this

    try {
                XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
                factory.setNamespaceAware(true);
                XmlPullParser xpp = factory.newPullParser();
    
                xpp.setInput(new StringReader(xmlData));
                int eventType = xpp.getEventType();
                while (eventType != XmlPullParser.END_DOCUMENT) {
                    if (eventType == XmlPullParser.START_DOCUMENT) {
                        System.out.println("Start document");
                    } else if (eventType == XmlPullParser.START_TAG) {
                        if(xpp.getName().equalsIgnoreCase("REF"))
                        {
                            System.out.println("REF Text = " + xpp.getAttributeValue(0));
                        }
                        System.out.println("Start tag " + xpp.getName());
                    } else if (eventType == XmlPullParser.END_TAG) {
                        System.out.println("End tag " + xpp.getName());
                    } else if (eventType == XmlPullParser.TEXT) {
                        System.out.println("Text  = " + xpp.getText());
    
                    }
                    eventType = xpp.next();
                }
                System.out.println("End document");
            } catch (Exception e) {
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find a away to extract a site title from a URL
I want to extract Title, Description & images from URL using HTML Agility utility
Not able to download artifacts from central maven repository. <mirrors> <!-- mirror | Specifies
Not able to store all binary data values into sqlite3 table using QT. For
I try to extract specific data from an xml feed that comes from youtube.
I am able to extract my application apk file from PC. I am using
I have a really large table that I am not able to extract. This
I am sure this is pretty basic, but I am not able to extract
I am trying to open homepages of websites and extract title and description from
I am trying to extract data from Civic Commons Apps link for my project.

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.