Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old February 20th, 2006, 11:18 PM
XML newbie: Urgent pls help!
Guest
 
Posts: n/a
Default How to check for value of node

ok, I changed "If node.Text = "Success" " to "If Not loginDom.InnerText Is
Nothing ". Now, I don't get the NullReference error but the SessionID I see
on screen is concatanated one. It looks like:XXXXXX=YYYYY==, but did I do
wrong. Althouggh, I get the message, Satus as Success.Since, I have to use
this SessionID in another click event on the same page, how do I do this.I
tried,

g_SessionID= loginDom.Value
g_SessionID = loginDom.InnerText

I noticed, I don'et get any value for Node.

I appreciate your quick reply and thanku in advance. I am enclosing the
function below:


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


Try


ParseLoginResponse = False


'Feb13
Dim filterDoc As New XmlDocument

'Feb16
'Instantiate an XmlNamespaceManager object
Dim nsmgr As XmlNamespaceManager
nsmgr = New XmlNamespaceManager(filterDoc.NameTable)


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

nsmgr.AddNamespace("ns", "urn:schemas -tms:LoginResponse")

Dim node As XmlDocument



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



'testing feb17

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
'Console.WriteLine("Login successful: " & node.Value)
Console.WriteLine("Login successful: " & loginDom.InnerText)
node =
loginDom.SelectSingleNode("ns:LoginResponse/ns:SessionID", nsmgr)
'Feb 20
Console.WriteLine("Login successful: " & node.Value)




'new for testing Feb16
'Dim resultImport As XmlNode
'resultImport = filterDoc.ImportNode(node, True)
'filterDoc.AppendChild(resultImport)
'Return True
'g_SessionID = loginDom.Value
ParseLoginResponse = True

Console.WriteLine("Login successful: " & loginDom.InnerXml)


'Feb14

Else
'The login was not 100% successful
node =
loginDom.SelectSingleNode("ns:LoginResponse/ns:SystemMessage")
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

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles