Ok you need to remeber that the first node <TAGNAME></TAGNAME> will be 0 then 1,2,3 and so on so all you really need do is change the childnode numbers to suit in the "for each" section and the getElementsByTagName("YourTagName") see example XML here:
<?xml version='1.0'?>
<Products> <---------------------------- This is your TagName
<Product ID="1" Name="Chai"
Price="13"> <-------------------------- ChildNodes(0)
<Desc Value="10 boxes x 20 Bags"/> <-------------- ChildNodes(1)
</Product>
<Product ID="2" Name="Chang"
Price="10">
<Desc Value="24 -12 oz bottles"/>
</Product>
<Product ID="3" Name="Tofu"
Price="23.25">
<Desc Value="40-100 kg pkgs"/>
</Product>
</Products>
########## CODE ################
<%@ Language="VBScript" %>
<% Option Explicit %>
<% Response.Charset = "UTF-8" %>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>XML Reader</title>
</head>
<body>
<%
Dim objXML
Dim objItemList
Dim objItem
Dim strHTML
Set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocumen t")
objXML.async = False
objXML.setProperty "ServerHTTPRequest", True
objXML.Load("LINKTOXMLFILE")
If objXML.parseError.errorCode <> 0 Then
Response.Write "<pre>" & vbCrLf
Response.Write "<strong>Error:</strong> " & objXML.parseError.reason
Response.Write "<strong>Line:</strong> " & objXML.parseError.line & vbCrLf
Response.Write "<strong>Text:</strong> " _
& Server.HTMLEncode(objXML.parseError.srcText) & vbCrLf
Response.Write "</pre>" & vbCrLf
End If
Set objItemList = objXML.getElementsByTagName("item")
Set objXML = Nothing
' HERE'S WHERE YOU NEED TO LOOK
'----------------------------------
For Each objItem In objItemList
strHTML = strHTML & "<p>" & vbCrLf
strHTML = strHTML & "<a href=""" & objItem.childNodes(2).text & """>"
strHTML = strHTML & "<strong><em>" & objItem.childNodes(0).text
strHTML = strHTML & "</em></strong></a><br />" & vbCrLf
strHTML = strHTML & objItem.childNodes(1).text & vbCrLf
strHTML = strHTML & "</p>" & vbCrLf
Next
Set objItemList = Nothing
Application.Lock
Application("ShowXML") = strHTML
Application("XMLDATE") = Now()
Application.UnLock
%>
<%= Application("fishNewsContent") %>
<!--<%= Application("XMLDATE") %>-->
</body>
</html>
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks