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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:54:22+00:00 2026-06-04T08:54:22+00:00

From this XML code: <?xml version=1.0 encoding=utf-8?> <Tabel> <Member> <Naam>Cruciatum</Naam> <Kills>1000</Kills> <Deaths>10</Deaths> <KD>100</KD> </Member>

  • 0

From this XML code:

<?xml version="1.0" encoding="utf-8"?>
<Tabel>
  <Member>
    <Naam>Cruciatum</Naam>
    <Kills>1000</Kills>
    <Deaths>10</Deaths>
    <KD>100</KD>
  </Member>
  <Member>
    <Naam>Ghostbullet93</Naam>
    <Kills>10</Kills>
    <Deaths>1</Deaths>
    <KD>10</KD>
  </Member>
</Tabel>

How can I get (for example) the 10 next to <Kills> ?

I’ve tried multiple things without any success.
One of the ideas I had was using this code:

Dim doc = XDocument.Load("C:\members.xml")
        Dim members = From m In doc.Element("Tabel").Elements("Member")
                      Select naam = m.Element("Naam").Value
        For Each member In members
            lstmembers.Items.Add(member)
        Next

But I can’t figure out how to edit that snippet to work with what I need it to do now.

(The above code works perfectly for where it’s used.)

  • 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-04T08:54:23+00:00Added an answer on June 4, 2026 at 8:54 am

    You can also use XPath to read the element’s value:

    Dim doc As XmlDocument = New XmlDocument()
    doc.Load("C:\members.xml")
    Dim kills As String = doc.SelectNode("Tabel/Member[Naam='Ghostbullet93']/Kills").InnerText
    

    If, however, you intend to load and use all the data, it would be far easier to use serialization. To do that, you first need to create classes that mimic the XML structure (for simplicity sake I’ll just use public string fields, but it would be better to use properties):

    Public Class Member
        Public Naam As String
        Public Kills As Integer
        Public Deaths As Integer
        Public KD As Integer
    End Class
    
    Public Class Tabel
        <XmlElement("Member")> _
        Public Members As List(Of Member)
    End Class
    

    Then deserialize the XML like this:

    Dim serializer As XmlSerializer = New XmlSerializer(GetType(Tabel))
    Dim tabel As Tabel = CType(serializer.Deserialize(File.OpenRead("C:\members.xml")), Tabel)
    For Each member As Member in tabel
        Dim kills As Integer = member.Kills
    Next
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to load the inside values from this xml code: <?xml version=1.0 encoding=UTF-8?>
I am reading data from XML like this: (Contacts.xml) <?xml version=1.0 encoding=utf-8 standalone=yes?> <!--LINQ
I have this data from a xml file: <?xml version=1.0 encoding=utf-8 ?> <words> <id>...</id>
Given this XML: <?xml version=1.0 encoding=utf-8 ?> <queryableData> <table displayName=Shipments dbName=Quotes> <foreignKey column=CustomerId references=CustomerRegistration/>
This is my original xml: <?xml version=1.0 encoding=UTF-8?> <table> <row> <id>12</id> <name>Mickey Mouse</name> </row>
Imagine this as the code from build.xml: <project name=test project> <target name=first> <echo>first</echo> </target>
How to get DataType specific DataTable from XML This is my code string XMLReportFormat
I have this XML file from which I'm grabbing all the data: <?xml version=1.0
I have a xml file which has the following header: <?xml version=1.1 encoding=UTF-8?> .
I am parsing data from this XML url The text input varies, depending on

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.