G
Guest
Hi
I'm pretty new at this so please don't laugh too hard. I'm trying to load
an xml document using VB.NET and having a hard time. My code doesn't crash
but it doesn't work either, the first msgbox returns 0.
Help (please!)
Below is my document and snippet of code
<?xml version="1.0" encoding="utf-8"?>
<CAREKEEPER xmlns="http://tempuri.org/config1.xsd">
<TABLEINFORMATION TABLE="workers" ssn="ssn" emplid="userinput1">
</TABLEINFORMATION>
<SERVERS hostname="sta0wp02" database="vividcare">
</SERVERS>
<SERVERS hostname="rdy1cn02" database="vividcare">
</SERVERS>
</CAREKEEPER>
CODE:
Try
xml_doc.Load("../config.xml")
xml_nodelist = xml_doc.SelectNodes("/carekeeper")
MsgBox(xml_nodelist.Count())
For Each xml_node In xml_nodelist
server = xml_node.Item("SERVER").InnerText()
MsgBox(server)
Next
Catch ex As Exception
MsgBox("XMLPARSER: CONFIGURATION FILE ERROR " & ex.Message & " "
& ex.Source)
End Try
I'm pretty new at this so please don't laugh too hard. I'm trying to load
an xml document using VB.NET and having a hard time. My code doesn't crash
but it doesn't work either, the first msgbox returns 0.
Help (please!)
Below is my document and snippet of code
<?xml version="1.0" encoding="utf-8"?>
<CAREKEEPER xmlns="http://tempuri.org/config1.xsd">
<TABLEINFORMATION TABLE="workers" ssn="ssn" emplid="userinput1">
</TABLEINFORMATION>
<SERVERS hostname="sta0wp02" database="vividcare">
</SERVERS>
<SERVERS hostname="rdy1cn02" database="vividcare">
</SERVERS>
</CAREKEEPER>
CODE:
Try
xml_doc.Load("../config.xml")
xml_nodelist = xml_doc.SelectNodes("/carekeeper")
MsgBox(xml_nodelist.Count())
For Each xml_node In xml_nodelist
server = xml_node.Item("SERVER").InnerText()
MsgBox(server)
Next
Catch ex As Exception
MsgBox("XMLPARSER: CONFIGURATION FILE ERROR " & ex.Message & " "
& ex.Source)
End Try