Similar Threads:
1.Problem InfoPath Form once deployed (XML Parsing Problem?)
2.XML parsing problem finding a specific element in a specific place
Hi, I have the following XML and I like to grab the node that is in
'List2' and mobilenum=416-222-5435
I have tried the following,
XmlNode xmlNode = xmlDoc.SelectSingleNode(@"/contacts/list
[@name='List2']/contact/@mobilenum=416-222-5435");
and
XmlNode xmlNode = xmlDoc.SelectSingleNode(@"/contacts/list
[@name='List2']/contact/@mobilenum='416-222-5435'");
but I get an error 'Expression must evaluate to a node-set.' Any
idea?
<contacts>
<list name="list1">
<contact>
<name>Name1</name>
<mobilenum>416-223-3345</mobilenum>
<email> XXXX@XXXXX.COM </email>
<profession>Web Manager</profession>
</contact>
</list>
<list name="List2">
<contact>
<name>Name2</name>
<mobilenum>416-222-5435</mobilenum>
<email>email</email>
<professionbbbb</profession>
</contact>
<contact>
<name>Name</name>
<mobilenum>416-223-2342</mobilenum>
<email>someemail</email>
<profession>aaaa</profession>
</contact>
</list>
</contacts>
Thanks
Maz.
3.parsing problem with unicode (utf-16) xml file
hi,
i am trying to open a xml file which is in unicode format utf-16.
the file is
<?xml version="1.0" encoding="UTF-16"?>
<CurrentWeather>
<Location>Bombay / Santacruz, India (VABB) 19-07N 072-51E
14M</Location>
<Time>Mar 10, 2006 - 12:40 AM EST / 2006.03.10 0540 UTC</Time>
<Wind> from the WSW (240 degrees) at 5 MPH (4 KT):0</Wind>
<Visibility> 1 mile(s):0</Visibility>
<SkyConditions> partly cloudy</SkyConditions>
<Temperature> 80 F (27 C)</Temperature>
<DewPoint> 66 F (19 C)</DewPoint>
<RelativeHumidity> 61%</RelativeHumidity>
<Pressure> 29.94 in. Hg (1014 hPa)</Pressure>
<Status>Success</Status>
</CurrentWeather>
i am using following code to lode the file
XmlDocument doc = new XmlDocument();
doc.Load("C:\\mm.xml");
XmlDeclaration decl = (XmlDeclaration) doc.FirstChild;
Console.WriteLine("\n{0}", "XML DECLARTION:");
Console.WriteLine("{0}", "Version " + "= " + decl.Version);
Console.WriteLine("{0}", "Encoding " + "= " + decl.Encoding);
Console.WriteLine("{0}", "Standalone " + "= " + decl.Standalone);
but i am getting problem at line 3
the error is thers is no unicode byte order mark.cannot switch to
unicode
please help me
4.XML Parsing Problem
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>
5.ServerXMLHTTP.3.0 parsing problem
6. xml parsing problem
7. XML Parsing Problem in Internet Explorer
8. AJAX XML parsing problem