[thelist] beginner XML ASP question

Jacques Capesius jacques_capesius at cnt.com
Mon Sep 30 21:23:16 CDT 2002


Hi guys,

This is probably something really stupid that I'm doing wrong, but I'm
toying with viewing an XML Document with ASP - very basic stuff, but I'm
getting an error and I'm not sure why, nor how exactly to fix it. I'm pretty
new to the XML thing, so this is probably an easy question for a lot of you.

Anyway, here's a very basic XML document I'm trying to load, test.xml

<?xml version="1.0"?>
<web_articles>
	<webObject>
		<IDNo>1</IDNo>
		<Title>How to code in XML</Title>
		<Subject>XML</Subject>
		<keywords>XML Code</keywords>
		<content>First you do this, and the you do that.</content>
	</web_object>
	<webObject>
		<IDNo>2</IDNo>
		<Title>Press Release 3</Title>
		<Subject>Press Release</Subject>
		<keywords>Press Release ActiveCorp</keywords>
		<content>We announced today the acquisition of ActiveCorp.
Hooray!
		</content>
	</web_object>
</webarticles>

here's the asp page I'm trying to view it through.

Option Explicit
Response.Buffer = True

Dim xml
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("test.xml"))
Response.Write(xml.documentElement.childNodes(0).text)
%>

Running that code against that page causes me to get this error. It happens
on the "Response.Write..." line.

Object required: 'documentElement'
/loadxml.asp, line 11

I am trying to display the contents of the first IDNo tag, hence "1". Do any
of you wizards know what I'm doing wrong?

Thanks!

-jacques :)



More information about the thelist mailing list