In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to delete XML nodes by LINQ". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "LINQ how to delete XML nodes"!
LINQ removes the C # code for a specific XML node:
Using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; using System.Xml.Linq; namespace ConsoleApplication_XML {class Program {static void Main (string [] args) {XElement file = XElement.Load (@ ".. / Info.xml"); XElement temp = null IEnumerable query = from elem in file.Element ("applicationPools"). Elements ("add") where (string) elem.Attribute ("name") = = "chenjiangsite" select elem; foreach (var e in query) {temp = e;} temp.Remove (); Console.WriteLine (file);}
LINQ removes the XML code for a specific XML node:
< IIS7Info > < applicationPools > < add name= "DefaultAppPool" / > < add name= "Classic .NET AppPool" managedPipelineMode= "Classic" / > < add name= "domainManager" > < processModel identityType= "LocalSystem" / > < / add > < add name= "OCSPISAPIAppPool" managedPipelineMode= "Classic" > < processModel idleTimeout= "00:00:00" / > < recycling > < periodicRestart requests= "0" time= "00:00:00" / > < / recycling > < / add > < applicationPoolDefaults > < processModel identityType= "NetworkService" / > < / applicationPoolDefaults > < / applicationPools > < / IIS7Info >
Please press any key to continue. . . Save the file and OK it.
At this point, I believe you have a deeper understanding of "LINQ how to delete XML nodes". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.