473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

MSXML4 - parsing XML Leaves with multiple parameters

Hi, Rather new to MSXML4. I am parsing an XML data-stream over HTTP,
and would like to know why I cannot parse XML nodes with multiple
parameters.

The XML and Code are below, BUT I would like to know how to parse
individual XML nodes when tags are specified as
"<FIELD NAME="collection">myVal........".

The code below gives me "FIELD" as the value of the XML, not myVal.

All the examples I have found use "<COLLECTION>......." only (without
the parameter).

Some sample code would be good. :)

thanks

Miles.

Sample XML
----

- <RESULTSET FIRSTHIT="1" LASTHIT="10" HITS="10" TOTALHITS="24"
MAXRANK="7909" TIME="0.0780">
- <HIT NO="1" RANK="1908" SITEID="0" MOREHITS="0">
<FIELD NAME="rank">1908</FIELD>
<FIELD
NAME="docid">c42c797ceb8fc321d762335cb4028b42-deployertest</FIELD>
<FIELD NAME="collection">collection test</FIELD>
<FIELD NAME="title">test content- Content</FIELD>
<FIELD NAME="description">test description</FIELD>
</HIT>
[snip]
----
Sample Code
----
<%@ Language="VBScript" %>
<html lang="en">
<head>
<title>Some feeds</title>
<script runat="server" language="VBScript">

Sub OutputFeed ()
Dim returnString
Dim myXML
Dim SoapRequest
Dim SoapURL
Dim myQuery
Dim Loaded

Set SoapRequest = Server.CreateObject("MSXML2.XMLHTTP")
Set myXML =Server.CreateObject("MSXML.DOMDocument")

myXML.Async=False

SoapURL = "http://server/search?query=crime"
SoapRequest.Open "GET",SoapURL , False
SoapRequest.Send()

Loaded = myXML.load(SoapRequest.responseXML)

If Loaded Then
Dim Items, Item, Title, Link, Description, TitleText,
DescriptionText, LinkURL
Set Items = myXML.documentElement.selectNodes("//HIT")
Response.Write "<p>Feed from " & SoapURL & " has currently " &
Items.Length & " items.</p>" & VbCrLf
Response.Write "<ul>" & VbCrLf
For Each Item in Items
Set Title = Item.selectSingleNode("title")

If Title Is Nothing Then
TitleText = ""
Else
TitleText = Title.text
End If

Set Link = Item.selectSingleNode("teaser")

If Link Is Nothing Then
LinkURL = ""
Else
LinkURL = Trim(Link.data)
End If

Set Description = Item.selectSingleNode("description")
If Description Is Nothing Then
DescriptionText = ""
Else
DescriptionText = Description.data
End If

Response.Write "<li><a href=""" & LinkURL & """>" & TitleText & ": "
& DescriptionText & "</a></li>" & VbCrLf
Next
Response.Write "</ul>" & VbCrLf
End If
End Sub
</script>
</head>
<body>
<h1>Some feeds</h1>
<%
OutputFeed()

%>
</body>
</html>

----

Jul 20 '05 #1
0 1441

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: tweety | last post by:
I had a problem with IE 6.0.2800. The responseText property of the XMLHTTP object was giving an error.There was a bug in msxml dll. so i upgraded to msxml4 and changed the code to the following: ...
1
by: T | last post by:
Is there a way to use the Visual Studio .NET IDE to validate a schema using the MSXML4 parser? Similarly, is there a way to get the .NET framework utilities, such as the xsd.exe and wsdl.exe...
1
by: jd | last post by:
I have an xsl file to generate xml in to an html file. The size of the xsl is 300kb and size of the xml is 47 kb (the size of xml is variable). I am using VB.net to convert the xml file into an...
2
by: VernonR | last post by:
I'm having problems getting the .NET 1.1 XSL transform to cross reference using ID / IDREF correctly. I have collapsed to a simple set of files to show the problem more clearly... The output...
3
by: Eugen Gulinsky | last post by:
Hello guys, I am having problems trying to migrate our MSXML4-compatible stylesheets containing large msxsl:script blocks to a formate understandable by System.Xml:Xsl.XslTransform. I keep...
17
by: Mark | last post by:
I must create a routine that finds tokens in small, arbitrary VB code snippets. For example, it might have to find all occurrences of {Formula} I was thinking that using regular expressions...
7
by: Alan | last post by:
Hi. I have programmed in C++ before, but I`m a couple of years out of practice. I am seeking some advice on getting started on a quickie project. . . . I have to read a 54MB text file and do a...
0
by: =?Utf-8?B?RHVja3dvbg==?= | last post by:
Hello everyone, I need to get the version number of a couple of DLLs (comctl32.dll and msxml4.dll). I don't have the full path because I don't want to assume they will be in the system32 folder....
3
by: aspineux | last post by:
My goal is to write a parser for these imaginary string from the SMTP protocol, regarding RFC 821 and 1869. I'm a little flexible with the BNF from these RFC :-) Any comment ? tests= def...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.