Process XML in Dot Net -> Parse to Object
Here we consider a small aspect found while parsing XML string. We are using Dot Net (1.1) but we process xml in general (non-dotnet specific version) using the XPath expressions. Situation is we have XML string format as: task TASK_COMPLETE 02000016000004630144000100000070 02000016000004630154000200000070 2007-09-06T15:26:25+04:00 = strXMLMsg Scene 1: Dim xmlDoc As New Xml.XmlDocument xmlDoc.LoadXml(strXMLMsg) strXPath = "/XMLMessage /EventName" xmlNode = xmlDoc.SelectSingleNode(strXPath) strData = xmlNode.InnerText In this seen we will not be able to get our parsed data. And the issue is the inclusion of the namespace and its prefix. So to get the parsed data correctly we have to use the way shown in scene 2. Scene 2: Dim xmlDoc As New Xml.XmlDocument xmlDoc.LoadXml(strXMLMsg) xsn = New Xml.XmlNamespaceManager(xmlDoc.NameTable) XMLNamespace = "http://domain.com/codename/MessagesXMLSchema.xsd" XMLNamespacePrefix = "ns" xsn.AddNamespac...