473,668 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ho wo check for Value of node

HI,

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.InnerT ext, then I
get"SuccessSess ionID", 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 ParseLoginRespo nse(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
object.

Try
ParseLoginRespo nse = False

Dim filterDoc As New XmlDocument
'Instantiate an XmlNamespaceMan ager object
Dim nsmgr As XmlNamespaceMan ager
nsmgr = New XmlNamespaceMan ager(filterDoc. NameTable)
nsmgr.AddNamesp ace("ns", "urn:schema s -tms:LoginRespon se")
'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.Docume ntElement.Selec tSingleNode("ns :LoginResponse/ns:Status", nsmgr)
'Console.WriteL ine("Login successful: " & node.Value)

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

'new Feb 14
'If node Is Nothing Then

'for testing

node =
loginDom.Select SingleNode("ns: LoginResponse/ns:SessionID", nsmgr)
'Console.WriteL ine("Login successful: " & node.InnerText)
'Console.WriteL ine("Login successful: " & node.Name)
Console.WriteLi ne("Login successful: " & loginDom.InnerT ext)
'Feb 20
'Console.WriteL ine("Login successful: " & node.Value)


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


'new for testing Feb16 took out on Feb 23
'Dim resultImport As XmlNode
'resultImport = filterDoc.Impor tNode(node, True)
'filterDoc.Appe ndChild(resultI mport)
'Return True
'g_SessionID = loginDom.Value
ParseLoginRespo nse = True

'Feb23 commented out
'Console.WriteL ine("Login successful: " & loginDom.InnerX ml)
'Console.WriteL ine("Login successful: " & node.)


'Feb14

Else
'The login was not 100% successful
node =
loginDom.Select SingleNode("ns: LoginResponse/ns:SystemMessag e")
'Console.WriteL ine("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 btQueryAssetLis t_Click(ByVal sender As System.Object, ByVal
e As System.EventArg s) Handles btQueryAssetLis t.Click

Dim queryAssetListX ml As String
Dim queryAssetListR esponse As XmlDocument

queryAssetListX ml = "<?xml version='1.0' ?>" & _
"<QueryAssetLis t2
xmlns=""urn:sch emas-tms:QueryAssetL ist2"">" & _
"<SessionID >" & g_SessionID & "</SessionID>" & _
"</QueryAssetList2 >"

queryAssetListR esponse = SendXmlRequest( queryAssetListX ml)
Feb 23 '06 #1
0 1490

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
2627
by: Andy C | last post by:
I am new to python, so please bear with me if I am making some conceptual error. Basically I want to create a graph with an adjacency list representation, but I don't want any of the adjacency lists to have duplicate strings when it is avoidable. I have a function createEdge that adds an edge to the graph. The arguments will be distinct since they are read from text files. But basically I want to use the dictionary as a string pool,...
8
3070
by: J Peterman | last post by:
Im having a nightmare trying to understand these nodes and linked lists. I've posted my code for my node.h, node.cpp, linkedlist.h and linkedlist.cpp files in separates replies. Can someone explain to me how I create a list and traverse it? In particular, how do I make use of the node.h method GetNext()? I don;t know what to do with it.
3
4049
by: keepyourstupidspam | last post by:
Hi, I am using xerces dom C++, I want to change an element value, here is the code I am using but the element in the file is not getting updated. ... ... ... xercesc_2_4::DOMDocument* xmlDoc = parser->getDocument(); xercesc::DOMNodeList* list;
2
3776
by: Bob | last post by:
I have sitemap like XML, of which every element has an attribute "url", e.g. <record menu_id="240" name="Countries and States" url="Countries.aspx"> <record2 page_id="54" url="CountriesEdit.aspx" /> <record3 page_id="27" url="Regions.aspx"> <record4 page_id="55" url="RegionsEdit.aspx" /> </record3> </record> I need to compare whether a string value contains the url or not. If so,
1
9093
by: Philip Wagenaar | last post by:
I have an XML file that has a date element. I want to change this date to unix notation. This works, but if the XML does not have the element I cannot assign the DateField the value. How can I check first if the node exists before I try to replace it? Public Function ConvertDates(ByVal xmldoc As XmlDocument) As XmlDocument Dim nodelist As XmlNodeList Dim node As XmlNode Dim DateField As String
0
1192
by: XML newbie: Urgent pls help! | last post by:
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 =...
10
2194
by: raghu | last post by:
I have written code for single linked list...I get an error as Expression syntax in the line marked with ////////. Please correct me where am I going wrong. I compiled this in TURBO Compiler #include<stdio.h> #include<alloc.h> struct node { int data; struct node *link;
9
18678
by: Moses | last post by:
Hi All, How to check weather a node has sibling? Is there any function like " hasChildNodes() " Thanks in Advance Moses
2
3239
by: =?Utf-8?B?bWFib25k?= | last post by:
I'm using a treeview control. One parent node, several child nodes, several grandchild nodes. Each of the nodes has a checkbox. My question, when the user changes the check value of one of the grandchild nodes to true how do I automatically change that node's parent to check-true and so on up the tree.....and in reverse if the parent is changed to check-false how do I cascade that down to each of the child nodes and their child nodes.
0
8893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8797
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8583
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8656
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7401
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5681
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4205
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4380
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2791
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.