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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:11:24+00:00 2026-05-25T18:11:24+00:00

I am currently parsing an XML file to get a coordinate value using the

  • 0

I am currently parsing an XML file to get a coordinate value using the below code.

private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {

            WebClient busStops = new WebClient();
            busStops.DownloadStringCompleted += new DownloadStringCompletedEventHandler(busStops_DownloadStringCompleted);
            busStops.DownloadStringAsync(new Uri("http://www.location.com/file.xml"));


        }


        void busStops_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
                return;



            var busStopInfo = XDocument.Load("Content/BusStops2.xml");

            var Transitresults = from root in busStopInfo.Descendants("Placemark")
                                 let StoplocationE1 = root.Element("Point").Element("coordinates")
                                 let nameE1 = root.Element("name")


                                 select new TansitVariables

                                 {

                                     Stoplocation = StoplocationE1 == null ? null : StoplocationE1.Value,
                                     name = nameE1 == null ? null : nameE1.Value,

                                 };


            listBox2.ItemsSource = Transitresults;

        }

        public class TansitVariables
        {
            public string Stoplocation { get; set; }
            public string name { get; set; }

        }


    }

}

the value is in the String StopLocation, but I would like to convert this to 3 values Lat, Long and Alt.

I haven’t used String Split before and the documentation doesn’t explain how I can do this from a parsed output.

Out is this 174.732224,-36.931053,0.000000

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-05-25T18:11:25+00:00Added an answer on May 25, 2026 at 6:11 pm

    Given this output string, you can get your three numbers via:

    string result = "174.732224,-36.931053,0.000000";
    
    var items = result.Split(',');
    double longitude = double.Parse(items[0]);
    double latitude  = double.Parse(items[1]);
    double altitude = double.Parse(items[2]);
    

    Edit:

    The portion of your code that would require changing is likely:

        var Transitresults = from root in busStopInfo.Descendants("Placemark")
                     let StoplocationE1 = root.Element("Point").Element("coordinates")
                     let nameE1 = root.Element("name")
                     select new TansitVariables(
                          StoplocationE1 == null ? null : StoplocationE1.Value,
                          nameE1 == null ? null : nameE1.Value);
    
        listBox2.ItemsSource = Transitresults;
    }
    
    // Add properties to your class
    public class TransitVariables
    {
            // Add a constructor:
            public TransitVariables(string stopLocation, string name)
            {
                this.StopLocation = stopLocation;
                this.Name = name;
                if (!string.IsNullOrWhiteSpace(stopLocation))
                {
                     var items = stopLocation.Split(',');
                     this.Lon = double.Parse(items[0]);
                     this.Lat = double.Parse(items[1]);
                     this.Alt = double.Parse(items[2]);
                }
            }
    
            public string StopLocation { get; set; }
            public string Name { get; set; }
            public double Lat { get; set; }
            public double Lon { get; set; }
            public double Alt { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im currently parsing an xml file that is hosted on another PC via hosting
I have an XML file that needs parsing in PHP. I am currenlty using
Currently I am downloading and parsing my data from an XML file that is
I am parsing an xml file with three of the same elements: im:imageLink. Currently
Im parsing an xml file. My XML handler, my object that holds an Arraylist
I have xml file in server. I am parsing this xml using DOM(xml is
I currently have a csv file that I'm parsing with an example from here:
I am currently doing some XML parsing and I've chosen to use Hpricot because
I'm currently reading a regularly updated XML file with PHP (simpleXML). I'd like to
I am use libxml2 for XML parsing. The sample code on the libxml website

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.