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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:22:02+00:00 2026-06-13T10:22:02+00:00

I have get an xml file from a WebService <MasterProducts> <MasterProduct> <Productcode>023DDC</Productcode> <Description>Dell CRT

  • 0

I have get an xml file from a WebService

<MasterProducts> <MasterProduct> <Productcode>023DDC</Productcode> <Description>Dell CRT 17 Computer Monitor E771a</Description> <ThumbPic>NoImage.png</ThumbPic> <RRP>0.000000</RRP> <Stock>2</Stock> </MasterProduct> </MasterProducts>

The Chrome IDE I use automatically converts this to JSON, I’ve been trying to parse this without any success as I am quite new to Javascript.

The httpResponse returns an error variable and a data variable which holds the json file.

if(error===false)
{ 
    if(data !== '')
    { 
        objData = data.getElementsByTagName('MasterProducts');
        //returns a NodeList here
        var items = objData[0].getElementsByTagName('MasterProduct')[0].getElementsByTagName('Description')[0].firstChild.data;

    }
    else
    { 
        alert("No Data"); 
    } 
}

I have only gone as far as getting the nodelist but I haven’t been able to get the data I need from the tags.

EDIT:
Using an online converter I’ve gotten the JSON below

{
   "MasterProducts": {
      "MasterProduct": {
  "Productcode": "023DDC",
  "Description": "Dell CRT 17 Computer Monitor E771a",
  "ThumbPic": "NoImage.png",
  "RRP": "0.000000",
  "Stock": "2"
      }
  }
 }
  • 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-13T10:22:03+00:00Added an answer on June 13, 2026 at 10:22 am

    The JSON you’re getting back is valid, according to http://jsonlint.com/, so your script should be able to access the contents of data using dot notation, rather than having to parse nodes as with XML

    var data ={
                "MasterProducts": {
                    "MasterProduct": {   
                        "Productcode": "023DDC",
                        "Description": "Dell CRT 17 Computer Monitor E771a",
                        "ThumbPic": "NoImage.png",
                        "RRP": "0.000000",
                        "Stock": "2"
                     }   
                 }  
             }
    
     var description = data.MasterProducts.MasterProduct.Description;
    

    description will contain “Dell CRT 17 Computer Monitor E771a”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written simple code to get content from xml file to php. $xml
I have one problem , I want to get some data from XML file
i have a coode that are trying to get the id of xml file
I have a few windwos services. They get xml column from Sql server manipulate
hi i have a function that get information from xml data and print markers
I have created a cxf webservice within my cxf.xml file I have the following
I have been provided an XSD file to unmarshall the XML returned from an
I have a large xml file and want to get a defined number of
I need to cache some xml from a webservice to a local xml file
I'm developping a phonegap/android application. I have recuperated an xml file from a web

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.