I am trying to format xml entries I have so that I can use the xmltextreader without getting errors. I added a default header and footer in the event I notice there is no opening or closing tags. I remove illegal characters and check for unicode but I always find an issue where an entry slips in and gives the error: data at the root level is invalid and when I check that entry is slipped through the cleaning process or just has an unmatched tag somewhere. Now I use


Code:
Dim stringSplitter() As String = {"</entry>"} 
        ' split the file content based on the closing entry tag 
        sampleResults = _html.Split(stringSplitter, StringSplitOptions.RemoveEmptyEntries)
to split my xml into individual entries before I start the cleanup process. Here are my default headers;


Code:
Private defaultheader = "xmlns=""http://www.w3.org/2005/Atom""" 
    Private headerl As String = "<?xml version=""1.0"" encoding=""utf-8""?>" & vbNewLine & "<entry " & defaultNameSpace & ">" 
    Private footer As String = "</entry>"
is there any tool in the .net framework that can detect and cleanup unmatched tags so that I can get this to work. I mean works for the most part with a whole bunch of IF statements but just wondering if there is something more practical to use