I was having issues with xmlns in xml file and was creating unnecessary waste of time handling them. But i found below solution to remove xmlns from the xml file so that I can focus on only the required tags.
' Remove all xmlns:* instances from the passed XmlDocument
' to simplify our xpath expressions.
Dim newDom As New XmlDocument()
newDom.LoadXml(System.Text.RegularExpressions.Regex.Replace(oldDom.OuterXml, "(xmlns:?[^=]*=[""][^""]*[""])", "", System.Text.RegularExpressions.RegexOptions.IgnoreCase Or System.Text.RegularExpressions.RegexOptions.Multiline))
Return newDom
End Function
3 comments:
very nice, Thanks..
i get "Error Xml Root Elemet Is missing"
apparently is also necessary to eliminate the prefixes
Post a Comment