Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
XML
<?xml version="1.0" standalone="yes"?>
<root>
  <UserNode>
    <LoginID>1</LoginID>
    <Name>penchalaprasad</Name>
    <Number>9493602066</Number>
    <Email>prasad6058@gmail.com</Email>
    <DateOfBirth>1993-12-07</DateOfBirth>
    <HighestQualification>Post Graduation</HighestQualification>
    <Percentage />
    <College />
    <Location>Hyderabad</Location>
    <Hobbies />
    <Achivements />
  </UserNode>
  <UserNode>
    <LoginID>2</LoginID>
    <Name>prasanth</Name>
    <Number>8886388642</Number>
    <Email>prasanth.billupati@gmal.coim</Email>
    <DateOfBirth>1998-12-07</DateOfBirth>
    <HighestQualification>Post Graduation</HighestQualification>
    <Percentage>
    </Percentage>
    <College>
    </College>
    <Location>Hyderabad</Location>
    <Hobbies>
    </Hobbies>
    <Achivements>
    </Achivements>
  </UserNode>
</root>


thi is my data i want to deletet Usernode based on Login_id how can i do that

Posted
Comments
Suvendu Shekhar Giri 18-Nov-15 1:30am    
What have you tried so far to achieve this?
Prasad Billupati 18-Nov-15 2:01am    
i created a home page and login page if and i gave unique id for the user.in home page i am asking his details and storing into an xml file
i want to
Gyaneswar kumar 18-Nov-15 1:58am    
do you wan to use C#?
Prasad Billupati 18-Nov-15 2:01am    
yes

1 solution

C#
XmlNodeList Nodes = xDoc.GetElementsByTagName("UserNode");
for (int i = 0; i < Nodes.Count; i++)
    {
        if (Nodes[i].Attributes["LoginID"] != null)
        {
            if (Nodes[i].Attributes["LoginID"].InnerText="2")//for example
            {
               Nodes[i].parentNode.RemoveChild(Nodes[i]);
                xDoc.Save(ccConfigPath);
            }
        }
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900