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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:28:26+00:00 2026-06-18T11:28:26+00:00

I’m developing an application in which I’m getting JSON response from a URL. In

  • 0

I’m developing an application in which I’m getting JSON response from a URL. In that JSONresponse I have to parse JSONObject first. And, then I have to parse XML content in the JSONObject. Here is the sample of JSON response that I’m getting:

{
"output": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Results>\n    <Feed prov=\"dmoz\">\n        <ResultSet id=\"webListings\" source=\"DMOZ\">\n            <Listing description=\" - A bike shop in Brisbane. Stocks mountain bikes, road bikes, and BMX bikes.\n                    \" rank=\"1\" siteHost=\"http://www.lifecycle.net.au/\" title=\"Lifecycle Bike Shop\">\n                <ClickUrl type=\"body\">http://www.lifecycle.net.au/</ClickUrl>\n            </Listing>\n            <Listing description=\" - Videos and pictures taken of both sport bikes and dirt bikes.\n                    \" rank=\"2\" siteHost=\"http://roadanddirt.com/\" title=\"Road and Dirt\">\n                <ClickUrl type=\"body\">http://roadanddirt.com/</ClickUrl>\n            </Listing>\n</Results>"
}

Here is my Java code for parsing the API and getting XML in a String:

        HttpClient hClient = new DefaultHttpClient();
        HttpGet hGet = new HttpGet("API here");
        ResponseHandler<String> rHandler = new BasicResponseHandler();
        data = hClient.execute(hGet, rHandler);

        JSONObject json = new JSONObject(data);
        // get xml string form jsonObject
        String str_xml = json.getString("output");

I have parsed the JSONObject and now getting XML as a whole in a String, now I have to parse the whole XML and fix those in the listview, category wise. Please help me in parsing the XML and fixing those into listview. 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-06-18T11:28:27+00:00Added an answer on June 18, 2026 at 11:28 am

    get xml string from current json as :

     JSONObject json = new JSONObject("your json response");
    
     // get xml string form jsonObject
    
     String str_xml=json.getString("output");
    
     // now convert str_xml to xml document for xml parsing 
     DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
     DocumentBuilder db = factory.newDocumentBuilder();
     InputSource inStream = new InputSource();
     inStream.setCharacterStream(new StringReader(str_xml));
     Document doc = db.parse(inStream); //<<< get xml Document here
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jsonparser to parse data and images obtained from json response. When
I am using JSon response to parse title,date content and thumbnail images and place
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
I am confused How to use looping for Json response Array in another Array.
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I have an array which has BIG numbers and small numbers in it. I
I have a view passing on information from a database: def serve_article(request, id): served_article

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.