We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
'' The main directory that holds all the other directories '' Modify the directory path to fit your needs Dim mainDirPath As String = "C:\Working Directory\temp\" '' Get an array of directories that you will look into '' to modify the XML files Dim dirs = Directory.GetDirectories(mainDirPath) '' Iterate through all the directories For Each thisDir In dirs '' Select all the XML files and modify them For Each xmlFile In Directory.GetFiles(thisDir, "*.xml") '' Open each document Dim xdoc As XDocument = XDocument.Load(xmlFile) '' Query the document and find all elements that are not "ID' = to 0 Dim tables As List(Of XElement) = (From ele In xdoc.Descendants() Where ele.Name.LocalName.StartsWith("Table") AndAlso ele.Element("ID").Value <> "0" Select ele).ToList() '' Remove all unwanted elements from the main document tables.Remove() '' Save the modified file back to the file system xdoc.Save(xmlFile) Next Next
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.