Below I have copied in an xml page I'm trying to parse out and the code
I'm currently using to do it. My code works great but I want to change
the .Item(0). part of this code to a typed refrence of the child node.
I have tried everything. How do I search through the xml for these
named child nodes?
Dim nodelist As XmlNodeList
Dim node As XmlNode
Dim temp As String
nodelist = doc.SelectNodes ("/modeminfo/health")
For Each node In nodelist
'MsgBox(node.Ch ildNodes.Item(0 ).InnerText) ' 10 net
'MsgBox(node.Ch ildNodes.Item(1 ).InnerText) 'Modem State
'MsgBox(node.Ch ildNodes.Item(2 ).InnerText) 'sys desc
'MsgBox(node.Ch ildNodes.Item(3 ).InnerText) 'uptime
'MsgBox(node.Ch ildNodes.Item(4 ).InnerText) 'config file
temp = Split((node.Chi ldNodes.Item(5) .InnerText),
":")(1).Tri m
txtBrnsTx.Text = temp
temp = Split((node.Chi ldNodes.Item(6) .InnerText),
":")(1).Tri m
txtBrnsRx.Text = temp 'rx
temp = Split((node.Chi ldNodes.Item(7) .InnerText),
":")(1).Tri m
txtBrnsSnr.Text = temp 'snr
temp = Split((node.Chi ldNodes.Item(8) .InnerText),
":")(1).Tri m 'resets
txtBrnsResets.T ext = temp
temp = Split((node.Chi ldNodes.Item(9) .InnerText),
":")(1).Tri m 'resets
txtBrnsLostSync s.Text = temp
temp = Split((node.Chi ldNodes.Item(10 ).InnerText),
":")(1).Tri m 'resets
txtT3.Text = temp
'MsgBox(node.Ch ildNodes.Item(1 0).InnerText) 't3s
'MsgBox(node.Ch ildNodes.Item(1 1).InnerText) 'healthproctime
Next
<?xml version="1.0" ?>
- <modeminfo>
- <health>
<tennet>10net IP: 10.xx.154.157</tennet>
<modemstate>Mod em alive</modemstate>
<systemdescript ion>xxx</systemdescripti on>
<uptime>Uptim e : (436490525) 50 days, 12 hours 28 mins 25.25
seconds</uptime>
<configfile>Con fig File : "e10_m_XX_ccowp e_c10.cm"</configfile>
<tx>Transmit Level (TX) : 34.5</tx>
- <rx>
Receive Level (RX) :
<font color="red">19. 0</font>
</rx>
<snr>Rx Signal to Noise (SNR): 33.4</snr>
<resets>Reset s : 1</resets>
<lostsyncs>Lo st Syncs : 4</lostsyncs>
<t3s>T3 Timeouts : 5</t3s>
<healthproctime >26.4649</healthproctime>
</health>
<cpe>IP address MAC address xxxxx</cpe>
<bridgeproctime >20.9113</bridgeproctime>
<cmts>CMTS: something.net</cmts>
<mac>MAC: xx07.0e07.xxb9</mac>
- <extdata>
<macaddress>000 7.0e07.2db9</macaddress>
<ipaddress>11.2 12.151.157</ipaddress>
<primsid>3801 </primsid>
<qosprofileinde x>116</qosprofileindex >
<interface>c60u 5</interface>
<sysdescr />
<upstreampower> 0.00dbmv(snr=24 .63dbmv)</upstreampower>
<downstreampowe r>0.00dbmv(snr =-----dbmv)</downstreampower >
<timingoffset>2 821</timingoffset>
<initialtimingo ffset>2821</initialtimingof fset>
<receivedpower> 7.50</receivedpower>
<macversion>doc 1.0</macversion>
<qosprovisioned mode>doc1.0</qosprovisionedm ode>
<enabledocsis2. 0mode>y</enabledocsis2.0 mode>
<phyoperatingmo de>tdma</phyoperatingmod e>
<capabilities>{ frag=n,concat=y ,phs=n,priv=bpi }</capabilities>
<sidsaidlimit>{ maxussids=0,max dssaids=0}</sidsaidlimit>
<optionalfilter ingsupport>{802 .1p=n,802.1q=n} </optionalfilteri ngsupport>
<transmitequali zersupport>{tap ssymbol=0,numof taps=0}</transmitequaliz ersupport>
<numberofcpeips >0(maxcpeips=5) </numberofcpeips>
<cfgmax-cpe>5</cfgmax-cpe>
<flaps>5(may116 </flaps>
<errors>5crcs,0 hcses</errors>
<stnmtnfailures >0aborts,0exhau sted</stnmtnfailures>
<totalusflows>1 (1active)</totalusflows>
<totaldsflows>1 (1active)</totaldsflows>
<totalusdata>20 3330packets,241 94640bytes</totalusdata>
<totalusthrough put>0bitssec,0p acketssec</totalusthroughp ut>
<totaldsdata>77 051packets,7316 0463bytes</totaldsdata>
<totaldsthrough put>0bitssec,0p acketssec</totaldsthroughp ut>
<activeclassifi ers>0(max=nolim it)</activeclassifie rs>
<dsadsxmessages >permitall</dsadsxmessages>
<totaltimeonlin e>41d6h</totaltimeonline >
</extdata>
<extproctime>21 .4699</extproctime>
<scriptproctime >68.8469</scriptproctime>
</modeminfo>
Comment