I would like to know how to parse the following xml string using vb.net?
currxml="
<employee><addr ess_2></address_2><assi gnments><assign ment><assigned_ bargaini
ng_unit></assigned_bargai ning_unit><assi gned_department ></assigned_depart men
t><assigned_loc ations><assigne d_location></assigned_locati on></assigned_loca
tions><assigned _position></assigned_positi on><assigned_po sition_departme nt><
/assigned_positi on_department></assignment></assignments><ca tegory>TEAC</cat
egory><city>VIC TORIA</city><country_c ode>CAN</country_code><d emographic_barg
aining_unit></demographic_bar gaining_unit><d emographic_depa rtment></demograp
hic_department> <demographic_lo cation></demographic_loc ation><demograp hic_pos
ition></demographic_pos ition><email></email><employee _no>202307</employee_no
<fax_no></fax_no><first_n ame>MURIEL</first_name><las t_name>ANDREWS</last_na
me><middle_name ></middle_name><mo st_assigned_bar gaining_unit></most_assigned
_bargaining_uni t><most_assigne d_department></most_assigned_d epartment><most _
assigned_locati on></most_assigned_l ocation><most_a ssigned_positio n></most_as
signed_position ><most_assigned _position_depar tment></most_assigned_p osition_
department><pos tal_code>V8S
5G5</postal_code><pr eferred_name></preferred_name> <province_code> BC</provinc
e_code><salutat ion>MS</salutation><sin >706257185</sin><status>T</status><str
eet>1050 DEAL STREET</street><telepho ne_no></telephone_no></employee>"
here is my code so far:
Dim strreader = New StringReader(cu rrxml)
Dim xmldoc As New XmlDocument
xmldoc.LoadXml( currxml)
reader = New XmlNodeReader(x mldoc)
While reader.Read
Select Case reader.NodeType
Case XmlNodeType.Ele ment
If reader.Name = "category" Then
MsgBox(reader.N ame)
End If
End Select
End While
I do see the read.Name as category but it doesnt give me "TEAC". I dont get
any value in the msgbox. It is blank. Am I missing something?
I see the value for city which is "VICTORIA" but the reader.Name is "".
thanks for you help,
Will