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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:42:53+00:00 2026-06-14T12:42:53+00:00

I am trying to parse the values from this LINK , whose xml encoding

  • 0

I am trying to parse the values from this LINK, whose xml encoding is like this

<?xml version="1.0" encoding="utf-8"?>

when I tried to get response throws message in logcat as shown

11-19 17:25:13.350: W/System.err(3360): This is not valid URL
11-19 17:25:13.350: W/System.err(3360): java.lang.NullPointerException

When I tried with some other LINK ,whose encoding is like this

<?xml version="1.0" encoding="UTF-8"?> It works fine, I can parse the values.

is xml parsing failing due encoding not being UTF-8,it is utf-8 ??

How should I deal with this. I have done google and am new to XML parsing. This is my first parsing which I am trying to create. Please let me know the way.

updated with code :

public String getXmlFromUrl(String url) {

    String xml = null;

    try {            
        // defaultHttpClient
        HttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(url);           
        HttpResponse httpResponse = httpClient.execute(httpPost);
        HttpEntity httpEntity = httpResponse.getEntity(); 
        xml = EntityUtils.toString(httpEntity);
        System.out.println("response -- " + xml);

    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    // return XML
    return xml;
}
  • 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-14T12:42:55+00:00Added an answer on June 14, 2026 at 12:42 pm

    Straight away it looks like the problem is with Encoding of XML in your response.

    URL url = new URL("http://myurl.com");
    InputSource is = new InputSource(url.openStream());
    is.setEncoding("ISO-8859-1"); // Also Try UTF-8 or UTF-16
    BufferedReader br = new BufferedReader(new InputStreamReader(is.getByteStream()));
    String line,str;
    while((line=br.readLine())!=null)
    {
          str = str + line;
    }
    Log.i(TAG,str);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse the json values from the following stream: {id: tag:search.xxxxx.com,2005:xxxxxxxxxxx}
Trying to parse some XML but apparently this is too much for a lazy
I am trying to screen scrape values from a website. # get the raw
Get sunrise time and sun set times from xml from web. This is the
I'm trying to parse an RSS feed using LINQ to Xml This is the
What I'm trying to do is to get particular values from my DB and
I am having difficulty trying to return values from an XML file. Here is
I am trying to parse an RSS feed using Linq to XML like so:
I'm trying to parse the values separated by commas in these 4 example sources
I'm trying to parse out values within a script tag with mechanize + nokogiri.

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.