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

  • Home
  • SEARCH
  • 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 7986963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:00:28+00:00 2026-06-04T12:00:28+00:00

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

  • 0

My XML code is like this:

<?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>
  <Member>
    <Naam>test</Naam>
    <Kills>123</Kills>
    <Deaths>11</Deaths>
    <KD>11</KD>
  </Member>
</Tabel>

After processing, the XML should end up looking like this:

<?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>

After a bit of searching I came up with this code.

Apparently it worked for others, yet it just won’t work for me at all.

Private Sub btnDel_Click(sender As System.Object, e As System.EventArgs) Handles btnDel.Click
        playername = lstmembers.SelectedItem.ToString
        If MsgBox("Ben je zeker dat je " & playername & " wil verwijderen?", MsgBoxStyle.YesNo, "Confirmatie") = MsgBoxResult.Yes Then
            Dim xmldoc As New XmlDocument()
            xmldoc.load("C:\members.xml")
            Dim node As XmlNode = xmldoc.SelectSingleNode("Root/Naam[. = '" & playername & "']")
            If node IsNot Nothing Then
                node.ParentNode.RemoveChild(node)
                xmldoc.Save("C:\members.xml")
            End If
            'reload list
            loadfile()
        End If
    End Sub

I don’t get any exceptions, so the code must be right for something, just not for what I need apparently…

I hope you can see where I made my mistake.

  • 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-04T12:00:29+00:00Added an answer on June 4, 2026 at 12:00 pm

    Look at your XPath expression:

    "Root/Naam[. = '" & playername & "']"
    

    That’s expecting an element called Root. Your element is actually called Member, assuming you’ve really given us a representative file. You may need Tabel/Member/Naam – I can’t remember whether using XPath on a document implicitly starts at the document root element or not.

    I haven’t checked the rest of your code, but it’s at least worth trying that first. It looks like your code will actually just remove the Naam element, by the way – I think you may want:

    node.ParentNode.ParentNode.RemoveChild(node.ParentNode)
    

    (Or extract node.ParentNode to a separate local variable, of course.)

    Personally I would use LINQ to XML if at all possible – it would make life simpler – but that’s a different matter.

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

Sidebar

Related Questions

I am working with layout like in below xml code <?xml version=1.0 encoding=utf-8?> <LinearLayout
I have a XML Like this: <?xml version=1.0 encoding=utf-8?> <soap:Envelope xmlns:soap=http://www.w3.org/2003/05/soap-envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema> <soap:Body>
The 1.0.0.0 version of my Feature's Template.xml file looked like this: <?xml version=1.0 encoding=utf-8
I have an XML file which looks like this : <?xml version=1.0 encoding=UTF-8?> <resultset
i have a videoview in my application. the code is like this. <?xml version=1.0
I need to transpose an XML file such as this: <?xml version=1.0 encoding=UTF-8?> <products>
I have code like this: // Take the xml message and turn it into
Hi i have a code like this: $doc = new DOMDocument(); $doc->Load('courses.xml'); foreach ($doc->getElementsByTagName('courses')
When using XML serialization in C#, I use code like this: public MyObject LoadData()
I use C# code more-or-less like this to serialize an object to XML: XmlSerializer

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.