I am using multiple methods to parse xml, with xpathnavigator, regex expressions etc some of the types of parsing. However I strip the xml entries first either using string.split or xpathnavigator and xmldocument.load etc; but found that if there is an entry with bad xml it creates an error and the entire files is blacklisted to a temp folder. I thought I would use xmltextreader to read each entry and add it to a list but when I reach the bad entry, I am not sure how to just ignore that entry and move on to the next entry in the xml document.
Example code:
Try
Dim ureader as XmlTextReader = New XmlTextReader(New StringBuilder(result))
While ureader.read
Try
If ureader.Name = "entry" then
page = ureader.ReadInnerXml
entriesList.add("<entry>" & page & "</entry>")
EndIf
Catch ex as exception
Continue While
End Try
End While
Catch ex as Exception
log.logError(ex.message.tostring)
End Try