>>Public oDOM As XmlDocument = New XmlDocument >>oDOM.LoadXml(tcXML) >>Public oNSMgr As XmlNameSpaceManager = New XmlNamespaceManager(oDom) >>oNSMgr.AddNamespace("ns","http://www.mywebsite.com/services/core/transformation/transformationresults") >>oDom.SelectSingleNode("ns:TransformationResults/Status") >>>
>Imports System.IO >Imports System.XML > >Public Class XML > Public oDOM As XmlDocument = New XmlDocument > Public oXMLNodeList As XmlNodeList > Public oNode As XmlNode > Public cNodeInnerText As String = "" > Public oXmlNameSpaceManager As XmlNamespaceManager > Public cXmlNameSpaceManager As String = "" > > ' Get a XML node value > ' expC1 XML > ' expC2 Node > Public Function GetXMLNodeValue(ByVal tcXML As String, ByVal tcNode As String) As Boolean > Dim llSuccess As Boolean > Dim lcNode As String = "" > oDOM.LoadXml(tcXML) > > ' If we have a namespace > If cXmlNameSpaceManager.Length > 0 Then > oXmlNameSpaceManager = New XmlNamespaceManager(oDOM.NameTable) > oXmlNameSpaceManager.AddNamespace("ns", cXmlNameSpaceManager) > End If > > ' Select the node > If cXmlNameSpaceManager.Length = 0 Then > lcNode = tcNode > oNode = oDOM.SelectSingleNode(lcNode) > Else > lcNode = "//ns:" + Framework.StringFunction.StrTran(tcNode, "/", "/ns:") > oNode = oDOM.SelectSingleNode(lcNode, oXmlNameSpaceManager) > End If > > ' See if we obtained the node > If oNode Is Nothing Then > Framework.App.cError = "The node " + tcNode + " does not exist." > Return False > End If > > Try > cNodeInnerText = oNode.InnerText > llSuccess = True > Catch loError As Exception > Framework.App.ErrorSetup(loError) > End Try > Return llSuccess > End Function > >End Class >>
> Dim loXML As Framework.XML = New Framework.XML > loXML.cXmlNameSpaceManager = "http://www.mywebsite.com/services/core/transformation/transformationresults" > If loXML.GetXMLNodeValue(lcXML, "TransformationResults/FileTransformationResults/OutputFile") = False Then > lcHTML = lcHTML + "<TD ALIGN=RIGHT>" + Math.Round(((lnEnd - lnStart) / 10000000), 2).ToString("#0.00") > lcHTML = lcHTML + "<TD>Success with failure on renaming the file: " + Framework.App.cError > cHtml = lcHTML > Return False > End If >>