PDA

View Full Version : VB code errors


johnb.
10-26-2004, 09:15 PM
hey guys-

i'm gettin some errors with the following script and i can't figure out why. it makes it seem like there's a problem with my server, but if i put the same basic code in the middle of the page instead of calling a function, or if i have it use a text file as opposed to xml, there are no errors returned. thanks for any help. lemme know if i should explain it more in detail. thanks again-


<body>
<%
Dim xmlDoc
xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false
xmlDoc.load("fountains.xml")

Set nodes = xmlDoc.documentElement.selectNodes("product")

Dim iNode
%>
<table>
<tr>
<%
For each iNode in nodes
Dim myName, myPrice, myDesc
myName = iNode.selectSingleNode("name").text
myPrice = iNode.selectSingleNode("price").text
myDesc = iNode.selectSingleNode("desc").text
%>
<td><%= myName %></td>
<td><%= myPrice %></td>
<td><%= myDesc %></td>
<%
Next
Set nodes = nothing
Set xmlDoc = nothing
%>
</tr>
</table>

</body>

stuka
10-27-2004, 10:47 AM
What errors do you get when you set this up as a function, and what does it look like when it doesn't error out (or when it does, if this version doesn't?).

johnb.
10-27-2004, 07:03 PM
it tells me that there is a server error. that it can't create the object (line 4). i tried takin off the 'server' part of it and then it said that activex wasn't capable of doing something, can't quite remember the exact details. thanks-

stuka
10-28-2004, 12:30 PM
hmmm...I've been tinkering with XML docs in VB .NET, but not ASP, so I'm not familiar with the CreateObject bit. I've been using the .NET framework's classes for that, so you've rapidly slipped outta my limited knowledge range.

johnb.
10-28-2004, 06:43 PM
well then you can answer another question if you don't mind =), what's up with .NET as opposed to regular vb or asp? thanks-

selwonk
12-28-2006, 05:39 PM
Try:

xmlDoc = Server.CreateObject("Microsoft.XMLDOM")

instead of:

xmlDoc = CreateObject("Microsoft.XMLDOM")