469,963 Members | 1,956 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

Ho wo check for Value of node


I am working on VB.Net.My program connects to the remote host, once the
login values are verified, it sends the SessionID. My problem is Although in
"Logindom" variable( in the Auto window), I see it has child nodes, but nodes
= Nothing.. Since, I need to copy the value of SessionID in my next function,
how can I read the value of Node. If I do, LoginDom.InnerText, then I
get"SuccessSessionID", if there is no way to get node value then should I use
Trim to trim success from the result and use it in another function

Private Function ParseLoginResponse(ByRef loginDom As XmlDocument) As Boolean
' See if the login was successful. If so, get the SessionID.
' Otherwise, log the error.

'assign a avalue to it, initialize it in previous method. If you set
the property of an object in one event handler, once the event is finished
with the setting of the property, that value is lost unless you save the
whole object in a session variable. So in your code, you only set the value
in Button_Click1 but didn't save the changes anywhere. When Button_Click2's
event is executed, you start from the same uninitialized property of the

ParseLoginResponse = False

Dim filterDoc As New XmlDocument
'Instantiate an XmlNamespaceManager object
Dim nsmgr As XmlNamespaceManager
nsmgr = New XmlNamespaceManager(filterDoc.NameTable)
nsmgr.AddNamespace("ns", "urn:schemas -tms:LoginResponse")
'Dim node As XmlDocument
'node = New XmlDocument

Dim node As XmlNode

' Setup the Dom to use XPath queries and also setup
' an Xml namespace prefix for use in the XPath queries.

node =
loginDom.DocumentElement.SelectSingleNode("ns:Logi nResponse/ns:Status", nsmgr)
'Console.WriteLine("Login successful: " & node.Value)

If Not loginDom.InnerText Is Nothing Then
' The login was 100% successful so get the SessionID.

'new Feb 14
'If node Is Nothing Then

'for testing

node =
loginDom.SelectSingleNode("ns:LoginResponse/ns:SessionID", nsmgr)
'Console.WriteLine("Login successful: " & node.InnerText)
'Console.WriteLine("Login successful: " & node.Name)
Console.WriteLine("Login successful: " & loginDom.InnerText)
'Feb 20
'Console.WriteLine("Login successful: " & node.Value)

'Add after knowing which omethod contains the value of
'g_SessionID = node.InnerXml OR
'g_SessionID = loginDom.InnerXml.TrimEnd

'new for testing Feb16 took out on Feb 23
'Dim resultImport As XmlNode
'resultImport = filterDoc.ImportNode(node, True)
'Return True
'g_SessionID = loginDom.Value
ParseLoginResponse = True

'Feb23 commented out
'Console.WriteLine("Login successful: " & loginDom.InnerXml)
'Console.WriteLine("Login successful: " & node.)


'The login was not 100% successful
node =
'Console.WriteLine("Login unsuccessful: " & node.InnerText)

End If

Catch ex As Exception
MsgBox("Can't parse login information" & vbCrLf & ex.Message)

loginDom = Nothing
'node = Nothing

End Try
End Function

Private Sub btQueryAssetList_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btQueryAssetList.Click

Dim queryAssetListXml As String
Dim queryAssetListResponse As XmlDocument

queryAssetListXml = "<?xml version='1.0' ?>" & _
xmlns=""urn:schemas-tms:QueryAssetList2"">" & _
"<SessionID>" & g_SessionID & "</SessionID>" & _

queryAssetListResponse = SendXmlRequest(queryAssetListXml)
Feb 23 '06 #1
0 1316

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by J Peterman | last post: by
3 posts views Thread by keepyourstupidspam | last post: by
1 post views Thread by Philip Wagenaar | last post: by
reply views Thread by XML newbie: Urgent pls help! | last post: by
10 posts views Thread by raghu | last post: by
9 posts views Thread by Moses | last post: by
2 posts views Thread by =?Utf-8?B?bWFib25k?= | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.