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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:24:40+00:00 2026-05-12T17:24:40+00:00

I am looking for a way to read the following XML <Data> <MaxCount>10</MaxCount> <Points>

  • 0

I am looking for a way to read the following XML

<Data>
  <MaxCount>10</MaxCount>
  <Points>
    <Point X="10" Y="10"/>
    <Point X="20" Y="10"/>
    <Point X="30" Y="10"/>
    <Point X="40" Y="10"/>
    <Point X="50" Y="10"/>
    <Point X="60" Y="10"/>
  </Points>
</Data>

Basically I want to read all the point values into an array of Point objects (My point object has 2 properties X and Y) and the MaxCount into an integer. What is the best way to pull out the Point values from the XML file using C#?

Thanks

  • 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-12T17:24:40+00:00Added an answer on May 12, 2026 at 5:24 pm

    It can be done using XPath:

    public void CreatePoints(string xml)
    {
        XPathDocument doc = new XPathDocument(XmlReader.Create(new StringReader(xml)));
        var xPathNodeIterator = doc.CreateNavigator().Select("/Data/Points/Point");
        foreach (XPathNavigator node in xPathNodeIterator)
        {
            var x = node.SelectSingleNode("@X").ValueAsInt;
            var y = node.SelectSingleNode("@Y").ValueAsInt;
    
            new Point(x, y);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Looking for a way to read the following config file sample using a multi
I'm looking for a way to read the full text of a notification, because
I am looking for a way to read a tab delimited file of baseball
I'm looking for a way if you know the location where to read the
I'm looking for a faster way to calculate GC content for DNA strings read
I'm looking for the most time-efficient way to read STDIN line-by-line. The first line
I'm looking for a way to read a Git commit message with PHP. I
I am looking for an easy way to render a String into a rectangular
I'm looking for a way to serialize a POCO that contains some read-only properties.
I am looking for a way to read an input file and print only

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.