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.ChildNodes.Item(0).InnerText) ' 10 net
'MsgBox(node.ChildNodes.Item(1).InnerText) 'Modem State
'MsgBox(node.ChildNodes.Item(2).InnerText) 'sys desc
'MsgBox(node.ChildNodes.Item(3).InnerText) 'uptime
'MsgBox(node.ChildNodes.Item(4).InnerText) 'config file
temp = Split((node.ChildNodes.Item(5).InnerText),
":")(1).Trim
txtBrnsTx.Text = temp
temp = Split((node.ChildNodes.Item(6).InnerText),
":")(1).Trim
txtBrnsRx.Text = temp 'rx
temp = Split((node.ChildNodes.Item(7).InnerText),
":")(1).Trim
txtBrnsSnr.Text = temp 'snr
temp = Split((node.ChildNodes.Item(8).InnerText),
":")(1).Trim 'resets
txtBrnsResets.Text = temp
temp = Split((node.ChildNodes.Item(9).InnerText),
":")(1).Trim 'resets
txtBrnsLostSyncs.Text = temp
temp = Split((node.ChildNodes.Item(10).InnerText),
":")(1).Trim 'resets
txtT3.Text = temp
'MsgBox(node.ChildNodes.Item(10).InnerText) 't3s
'MsgBox(node.ChildNodes.Item(11).InnerText) 'healthproctime
Next
<?xml version="1.0" ?>
- <modeminfo>
- <health>
<tennet>10net IP: 10.xx.154.157</tennet>
<modemstate>Modem alive</modemstate>
<systemdescription>xxx</systemdescription>
<uptime>Uptime : (436490525) 50 days, 12 hours 28 mins 25.25
seconds</uptime>
<configfile>Config File : "e10_m_XX_ccowpe_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>Resets : 1</resets>
<lostsyncs>Lost 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>0007.0e07.2db9</macaddress>
<ipaddress>11.212.151.157</ipaddress>
<primsid>3801</primsid>
<qosprofileindex>116</qosprofileindex>
<interface>c60u5</interface>
<sysdescr />
<upstreampower>0.00dbmv(snr=24.63dbmv)</upstreampower>
<downstreampower>0.00dbmv(snr=-----dbmv)</downstreampower>
<timingoffset>2821</timingoffset>
<initialtimingoffset>2821</initialtimingoffset>
<receivedpower>7.50</receivedpower>
<macversion>doc1.0</macversion>
<qosprovisionedmode>doc1.0</qosprovisionedmode>
<enabledocsis2.0mode>y</enabledocsis2.0mode>
<phyoperatingmode>tdma</phyoperatingmode>
<capabilities>{frag=n,concat=y,phs=n,priv=bpi}</capabilities>
<sidsaidlimit>{maxussids=0,maxdssaids=0}</sidsaidlimit>
<optionalfilteringsupport>{802.1p=n,802.1q=n}</optionalfilteringsupport>
<transmitequalizersupport>{tapssymbol=0,numoftaps= 0}</transmitequalizersupport>
<numberofcpeips>0(maxcpeips=5)</numberofcpeips>
<cfgmax-cpe>5</cfgmax-cpe>
<flaps>5(may116</flaps>
<errors>5crcs,0hcses</errors>
<stnmtnfailures>0aborts,0exhausted</stnmtnfailures>
<totalusflows>1(1active)</totalusflows>
<totaldsflows>1(1active)</totaldsflows>
<totalusdata>203330packets,24194640bytes</totalusdata>
<totalusthroughput>0bitssec,0packetssec</totalusthroughput>
<totaldsdata>77051packets,73160463bytes</totaldsdata>
<totaldsthroughput>0bitssec,0packetssec</totaldsthroughput>
<activeclassifiers>0(max=nolimit)</activeclassifiers>
<dsadsxmessages>permitall</dsadsxmessages>
<totaltimeonline>41d6h</totaltimeonline>
</extdata>
<extproctime>21.4699</extproctime>
<scriptproctime>68.8469</scriptproctime>
</modeminfo> 1 2000
Instead of .ChildNodes.Item(#), try using .SelectSingleNode(targetNode)
For example, replace
MsgBox(node.ChildNodes.Item(0).InnerText)
with
MsgBox(node.SelectSingleNode("tennet").InnerText)
"pmclinn" <pm*****@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
:
: 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.ChildNodes.Item(0).InnerText) ' 10 net
: 'MsgBox(node.ChildNodes.Item(1).InnerText) 'Modem State
: 'MsgBox(node.ChildNodes.Item(2).InnerText) 'sys desc
: 'MsgBox(node.ChildNodes.Item(3).InnerText) 'uptime
: 'MsgBox(node.ChildNodes.Item(4).InnerText) 'config file
:
: temp = Split((node.ChildNodes.Item(5).InnerText),
: ":")(1).Trim
: txtBrnsTx.Text = temp
:
: temp = Split((node.ChildNodes.Item(6).InnerText),
: ":")(1).Trim
: txtBrnsRx.Text = temp 'rx
:
: temp = Split((node.ChildNodes.Item(7).InnerText),
: ":")(1).Trim
: txtBrnsSnr.Text = temp 'snr
:
: temp = Split((node.ChildNodes.Item(8).InnerText),
: ":")(1).Trim 'resets
: txtBrnsResets.Text = temp
:
: temp = Split((node.ChildNodes.Item(9).InnerText),
: ":")(1).Trim 'resets
: txtBrnsLostSyncs.Text = temp
:
: temp = Split((node.ChildNodes.Item(10).InnerText),
: ":")(1).Trim 'resets
: txtT3.Text = temp
:
:
: 'MsgBox(node.ChildNodes.Item(10).InnerText) 't3s
: 'MsgBox(node.ChildNodes.Item(11).InnerText)
'healthproctime
:
: Next
:
:
: <?xml version="1.0" ?>
: - <modeminfo>
: - <health>
: <tennet>10net IP: 10.xx.154.157</tennet>
: <modemstate>Modem alive</modemstate>
: <systemdescription>xxx</systemdescription>
: <uptime>Uptime : (436490525) 50 days, 12 hours 28 mins 25.25
: seconds</uptime>
: <configfile>Config File : "e10_m_XX_ccowpe_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>Resets : 1</resets>
: <lostsyncs>Lost 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>0007.0e07.2db9</macaddress>
: <ipaddress>11.212.151.157</ipaddress>
: <primsid>3801</primsid>
: <qosprofileindex>116</qosprofileindex>
: <interface>c60u5</interface>
: <sysdescr />
: <upstreampower>0.00dbmv(snr=24.63dbmv)</upstreampower>
: <downstreampower>0.00dbmv(snr=-----dbmv)</downstreampower>
: <timingoffset>2821</timingoffset>
: <initialtimingoffset>2821</initialtimingoffset>
: <receivedpower>7.50</receivedpower>
: <macversion>doc1.0</macversion>
: <qosprovisionedmode>doc1.0</qosprovisionedmode>
: <enabledocsis2.0mode>y</enabledocsis2.0mode>
: <phyoperatingmode>tdma</phyoperatingmode>
: <capabilities>{frag=n,concat=y,phs=n,priv=bpi}</capabilities>
: <sidsaidlimit>{maxussids=0,maxdssaids=0}</sidsaidlimit>
:
:
<optionalfilteringsupport>{802.1p=n,802.1q=n}</optionalfilteringsupport>
:
:
:
<transmitequalizersupport>{tapssymbol=0,numoftaps= 0}</transmitequalizers
upport>
:
: <numberofcpeips>0(maxcpeips=5)</numberofcpeips>
: <cfgmax-cpe>5</cfgmax-cpe>
: <flaps>5(may116</flaps>
: <errors>5crcs,0hcses</errors>
: <stnmtnfailures>0aborts,0exhausted</stnmtnfailures>
: <totalusflows>1(1active)</totalusflows>
: <totaldsflows>1(1active)</totaldsflows>
: <totalusdata>203330packets,24194640bytes</totalusdata>
: <totalusthroughput>0bitssec,0packetssec</totalusthroughput>
: <totaldsdata>77051packets,73160463bytes</totaldsdata>
: <totaldsthroughput>0bitssec,0packetssec</totaldsthroughput>
: <activeclassifiers>0(max=nolimit)</activeclassifiers>
: <dsadsxmessages>permitall</dsadsxmessages>
: <totaltimeonline>41d6h</totaltimeonline>
: </extdata>
: <extproctime>21.4699</extproctime>
: <scriptproctime>68.8469</scriptproctime>
: </modeminfo>
: This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: mike420 |
last post by:
In the context of LATEX, some Pythonista asked what the big
successes of Lisp were. I think there were at least three *big*
successes.
a. orbitz.com web site uses Lisp for algorithms, etc.
b....
|
by: Terry |
last post by:
Hi,
This is a newbie's question. I want to preload 4 images and only when
all 4 images has been loaded into browser's cache, I want to start a
slideshow() function. If images are not completed...
|
by: uestebanez |
last post by:
Hi everybody!
I have a little problem working with libxml SAX API.
The problem is that I don't know how to stop parsing when I have
processed the data I need. I don't want to parse all file, I...
|
by: gamehack |
last post by:
Hi all,
I was thinking about parsing equations but I can't think of any generic
approach. Basically I have a struct called math_term which is something
like:
struct math_term {
char sign;
int...
|
by: ankitdesai |
last post by:
I would like to parse a couple of tables within an individual player's
SHTML page. For example, I would like to get the "Actual Pitching
Statistics" and the "Translated Pitching Statistics"...
|
by: toton |
last post by:
Hi,
I have some ascii files, which are having some formatted text. I want
to read some section only from the total file.
For that what I am doing is indexing the sections (denoted by .START
in...
|
by: Anup Daware |
last post by:
Hi Group,
I am facing a strange problem here:
I am trying to read xml response from a servlet using XmlTextWriter.
I am able to read the read half of the xml and suddenly an exception:...
|
by: Chris Carlen |
last post by:
Hi:
Having completed enough serial driver code for a TMS320F2812
microcontroller to talk to a terminal, I am now trying different
approaches to command interpretation.
I have a very simple...
|
by: Philip Semanchuk |
last post by:
On Oct 12, 2008, at 5:25 AM, S.Selvam Siva wrote:
Selvam,
You can try to find them yourself using string parsing, but that's
difficult. The closer you want to get to "perfect" at finding URLs...
|
by: Felipe De Bene |
last post by:
I'm having problems parsing an HTML file with the following syntax :
<TABLE cellspacing=0 cellpadding=0 ALIGN=CENTER BORDER=1 width='100%'>
<TH BGCOLOR='#c0c0c0' Width='3%'>User ID</TH>
<TH...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
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,...
| |