Parsing Problem



  • 1. childNodes.Item info by string
    Is it possible to access node information (childNodes.Item().Text) with a string instead of a number? Instead of writing childNodes.Item(3).Text I would like something like this childNodes.Item('Customer').Text How can this be done? Regards Anders Sneckenborg SIMBAL syd AB
  • 2. Creating A New XML DOM Document...
    What is the correct syntax for creating a new XML DOM Document in MSXML 3? Is it: Dim x Set x = Server.CreateObject("MSXML.DOMDocument") How about MSXML 4.0?
  • 3. FSO and XML
    I am downloading and XML file from one of our server using the Microsoft.XMLHTTP and then FSO to re-create the XML file on ta local drive. The file size is running at around 9/10Mb at the moment, taking about 3 mins to create and the file seems to hit an error about 90% in: Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC driver for Oracle]General error Is this an error with Oracle timing out or the Script timing out??? Cheers all!! CHRIS

Parsing Problem

Postby frunny » Tue, 09 May 2006 17:56:43 GMT

Hi all,

I am now sitting here since 1 week and try to get to parse some little
xml with (old) ASP.
Yes, one week and I dont get it - either I think to difficult or I
didnt found the correct resource on the web.
anyway I want to parse this piece of xml

<rsp stat="ok">
		<user nsid="6453627" username="frunny" fullname="Mr.Frunny"/>

this is a rest response and the xml is fully loaded - i can put it out
in my website with
all is fine until now

now I want to parse it and try to read the "token" amd "perms" first -
but no luck, here is my code:

set nodeCol = xmlDom.documentElement.selectNodes("auth")
for each oNode in nodeCol

but this will not work I get a type missmatch "htmlencode"
I am totaly stuck into this and read a lot of things on the net but I
dont get it - what is the magic behind this ? It looks easy but it
seams not to.

any tipp or hint will be really great, also about reading the
attributes in the user element
thanks for your help

Re: Parsing Problem

Postby Anthony Jones » Tue, 09 May 2006 21:13:29 GMT

Your problem is that "token" and "perms" are elements not attributes try:-

  Response.Write(Server.HTMLEncode(GetElementText(oNode, "token")))
  Response.Write(Server.HTMLEncode(GetElementText(oNode, "perms")))

Function GetElementText(roNode, Path)
    Dim oNode
    Set oNode = roNode.selectSingleNode(path)
    If Not oNode is Nothing Then
       GetElementText = oNode.Text
    End If
End Function


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
XmlNode xmlNode = xmlDoc.SelectSingleNode(@"/contacts/list
but I get an error 'Expression must evaluate to a node-set.' Any

  <list name="list1">
      <email> XXXX@XXXXX.COM </email>
      <profession>Web Manager</profession>
  <list name="List2">

3.parsing problem with unicode (utf-16) xml file


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"?>
  <Location>Bombay / Santacruz, India (VABB) 19-07N 072-51E
  <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>

i am using following code to lode the file

	XmlDocument doc  = new XmlDocument();
			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

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),
            txtBrnsTx.Text = temp

            temp = Split((node.ChildNodes.Item(6).InnerText),
            txtBrnsRx.Text = temp 'rx

            temp = Split((node.ChildNodes.Item(7).InnerText),
            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


 <?xml version="1.0" ?>
- <modeminfo>
- <health>
  <tennet>10net IP: 10.xx.154.157</tennet>
  <modemstate>Modem alive</modemstate>
  <uptime>Uptime : (436490525) 50 days, 12 hours 28 mins 25.25
  <configfile>Config File : ""</configfile>
  <tx>Transmit Level (TX) : 34.5</tx>
- <rx>
  Receive Level (RX) :
  <font color="red">19.0</font>
  <snr>Rx Signal to Noise (SNR): 33.4</snr>
  <resets>Resets : 1</resets>
  <lostsyncs>Lost Syncs : 4</lostsyncs>
  <t3s>T3 Timeouts : 5</t3s>
  <cpe>IP address MAC address xxxxx</cpe>
  <mac>MAC: xx07.0e07.xxb9</mac>
- <extdata>
  <sysdescr />




5.ServerXMLHTTP.3.0 parsing problem

6. xml parsing problem

7. XML Parsing Problem in Internet Explorer

8. AJAX XML parsing problem

Return to xml


Who is online

Users browsing this forum: No registered users and 41 guest