Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Realtime gold price on website

Reply
Thread Tools

Realtime gold price on website

 
 
Guest
Posts: n/a
 
      06-22-2005
Adding Response.Write "nodeName = " & oXML.documentElement.nodeName & "<br>"
after oXML.load(cURL) gives me an error:
Object required: 'documentElement'

It seems like I had to add an extra step to get it to work, which I don't
like as your's is cleaner. Do you have any ideas as to why this was
necessary or any further steps in trouble shooting?

set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")

objHTTP.open "GET", cURL, false
objHTTP.send
set objXML = objHTTP.responseXML

Complete code:
<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit
'*
Const cOZT = 31.103477
Const cURL = "http://dgcsc.org/goldprices.xml"
'*
Dim iPRC, objHTTP, objXML, oXML
iPRC = 0.0000
'*

set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")

objHTTP.open "GET", cURL, false
objHTTP.send
set objXML = objHTTP.responseXML

set oXML=CreateObject("Microsoft.XMLDOM")
oXML.async= "false"
oXML.load(objXML)
iPRC = oXML.getElementsByTagName("Price").item(21).text
Set oXML = Nothing
'*
Response.Write "Gold Price: $" & Round(iPRC * cOZT,4) & " per ounce"
%>

"McKirahan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> <(E-Mail Removed)> wrote in message
> news:#c4DE$(E-Mail Removed)...
> > Almost there, but it won't read the XML data if I try HTTP:
> > oXML.load("http://dgcsc.org/goldprices.xml")
> > '* Doesn't work. I hardcoded the URL just to make sure it was calling

the
> > correct location.
> >
> > oXML.load(Server.MapPath("goldprices.xml"))
> > '* Works perfectly. For testing purposes I copied the goldprices.xml

file
> > from dgcsc.org into the same directly on the server as the ASP file.
> >
> > Anyone got any ideas how to get this last bit to work?
> > Here's the complete code:
> >
> > <%@ LANGUAGE="VBSCRIPT" %>
> > <% Option Explicit
> > '*
> > Const cOZT = 31.103477
> > Const cURL = "http://dgcsc.org/goldprices.xml"
> > '*
> > Dim iPRC
> > iPRC = 0.0000
> > '*
> > Dim oXML
> > Set oXML = CreateObject("Microsoft.XMLDOM")
> > oXML.async = "false"
> > '* oXML.load(cURL)
> > oXML.load(Server.MapPath("goldprices.xml"))
> > iPRC = oXML.getElementsByTagName("Price").item(21).text
> > Set oXML = Nothing
> > '*
> > Response.Write "Gold Price: $" & Round(iPRC * cOZT,4) & " per ounce"
> > %>

>
>
> "oXML.load(cURL)" works for me.
>
> How do you know "it won't read"?
>
> Try adding this line after "oXML.load(cURL)"
>
> Response.Write "nodeName = " & oXML.documentElement.nodeName & "<br>"
>
> (Watch for word-wrap.)
>
>



 
Reply With Quote
 
 
 
 
McKirahan
Guest
Posts: n/a
 
      06-22-2005
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Adding Response.Write "nodeName = " & oXML.documentElement.nodeName &

"<br>"
> after oXML.load(cURL) gives me an error:
> Object required: 'documentElement'
>
> It seems like I had to add an extra step to get it to work, which I don't
> like as your's is cleaner. Do you have any ideas as to why this was
> necessary or any further steps in trouble shooting?
>
> set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
>
> objHTTP.open "GET", cURL, false
> objHTTP.send
> set objXML = objHTTP.responseXML


[snip]

What's your O/S (+ version) and browser (+ version)?

For example, Win98SE and IE5.5 or WinXPPro and IE6.0.


 
Reply With Quote
 
 
 
 
Guest
Posts: n/a
 
      06-22-2005
W2K Server SP4 & IE 6 (all updates)
XPpro SP2 & IE 6 (all updates)

"McKirahan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Adding Response.Write "nodeName = " & oXML.documentElement.nodeName &

> "<br>"
> > after oXML.load(cURL) gives me an error:
> > Object required: 'documentElement'
> >
> > It seems like I had to add an extra step to get it to work, which I

don't
> > like as your's is cleaner. Do you have any ideas as to why this was
> > necessary or any further steps in trouble shooting?
> >
> > set objHTTP = Server.CreateObject("Microsoft.XMLHTTP")
> >
> > objHTTP.open "GET", cURL, false
> > objHTTP.send
> > set objXML = objHTTP.responseXML

>
> [snip]
>
> What's your O/S (+ version) and browser (+ version)?
>
> For example, Win98SE and IE5.5 or WinXPPro and IE6.0.
>
>



 
Reply With Quote
 
GunsGoldGod GunsGoldGod is offline
Junior Member
Join Date: Oct 2012
Posts: 1
 
      10-21-2012
Since the service for precious metal prices has disconntinued i found a new one: Precious Metals XML Price Feed ( http :// www .xmlcharts.com/precious-metals.html ) - Good luck!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
realtime oil price webservices? Jassim Rahma ASP .Net 1 07-14-2008 06:37 PM
Online price vs retail store price? Squiggle NZ Computing 74 12-07-2007 03:44 AM
computer spares price list | newly added Canada country price list| Nandhu Python 0 12-04-2007 02:56 PM
US price v Uk price /\\BratMan/\\ Digital Photography 19 11-23-2007 05:18 AM
Vista Ultimate: NZ price vs US Price whome NZ Computing 61 02-03-2007 12:11 PM



Advertisments