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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:47:17+00:00 2026-06-09T00:47:17+00:00

I would like to parse the xml data from a remote website http://services.faa.gov/airport/status/IAD?format=xml …But

  • 0

I would like to parse the xml data from a remote website http://services.faa.gov/airport/status/IAD?format=xml…But I was not able to parse the xml data and I am only getting error. But I was able to parse the JSON data from the same remote website http://services.faa.gov/airport/status/IAD?format=json. The code I have used to parse the xml data is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Aviation</title>
<script type="text/javascript" src="Scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
    var result;
    function xmlparser() {
        $.ajax({
            type: "GET",
            url: "http://services.faa.gov/airport/status/IAD?format=xml",
            dataType: "xml",
            success: function (xml) { 
                result = xml.city;
                document.myform.result1.value = result;
            },
            error: function (xml) {
                alert(xml.status + ' ' + xml.statusText);
            }
        });             
    }        
</script>    
</head>
<body>
<p id="details"></p>
<form name="myform">
    <input type="button" name="clickme" value="Click here to show the city name" onclick=xmlparser() />
    <input type="text" name="result1" readonly="true"/>        
</form>
</body>
</html>

I was only getting the error as ‘o Error’ in the alert box since I have printed the error message. Anybody please helpout to parse the xml data from the remote website.
Note: I have also ‘City’ instead of ‘city’ but its not working…
Thanks in advance…

  • 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-09T00:47:18+00:00Added an answer on June 9, 2026 at 12:47 am

    I don’t believe that will work since the service is still returning xml. jsonp is expecting a n object literal as an argument to pass to the callback. I believe if you run this locally you’ll realize there’s no data being consumable in your success. Try this

    $.ajax({
        type: "GET",
        url: "http://services.faa.gov/airport/status/IAD?format=json",
        dataType: "jsonp",
        success: function (data) {
            document.myform.result1.value = data.city;
        },
        error: function (jqXHR, textStatus, errorThrown) {
            alert(errorThrown);
        }
    });
    

    Here is the example for creating a proxy with asp.net mvc 3. I just created an action that returns a ContentResult which maps to a string but I define the content type as text/xml. This simply just makes a webrequest to the service and reads the stream in to a string to send back in the response.

    [HttpGet]
    public ContentResult XmlExample()
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://services.faa.gov/airport/status/IAD?format=xml");
        string xml = null;
        using (WebResponse response = request.GetResponse())
        {
            using (var xmlStream = new StreamReader(response.GetResponseStream()))
            {
                xml = xmlStream.ReadToEnd();
            } 
        }
    
        return Content(xml, "text/xml");
    }
    

    Your xmlParser function will look like this:

    <script type="text/javascript">
        var result;
        function xmlparser() {
            $.ajax({
                type: "GET",
                url: "XmlExample",
                dataType: "xml",
                success: function (xml) {
                    result = $(xml).find("City").text();
                    document.myform.result1.value = result;
                },
                error: function (xml) {
                    alert(xml.status + ' ' + xml.statusText);
                }
            });             
        }        
    </script> 
    

    jQuery ajax’s converts the data by using $.parseXML internally which removes the requirement for us to even call this in the success block. At that point you have a jQuery object that you can use it’s default DOM functions to find the City Node.

    Make sure to replace the XmlExample with the url that it maps to based on your controller.

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

Sidebar

Related Questions

I would like to know how to parse XML file from local in Titanium
I'm new to jQuery and would like to parse an XML document. I'm able
I would like to read multiple XML files in an array and then parse
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode
I would like to parse the folder name and file name from passed argument.
I would like to parse the values from aspx pages, both what is passed
I have some simple XML which I would like to parse into an array
I have to send an XML request to recover data from a remote server
Let's say I'm using simpleXML to parse weather data from a remote server, and
I've got this data I get from an XML feed and parse as NSDictionaries.

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.