|
|
 |
RE: FN-FORUM: Okay im stuck
date posted 4th May 2007 23:42
> -----Original Message-----
>
> I don't know visual basic, but I'd be surprised if it's not one of:
>
> objLst.item(i).attribute( 'rate' )
>
> or
>
> objLst.item(i).attributes( 'rate' )
>
> or
>
> objLst.item(i).getAttribute( 'rate' )
>
> Graham
Thanks that's what I needed. I had tried to use getAttribute("rate") but it
came back as a bad argument, attributes gave me an array to retrieve the
attributes. Here is the code in case anyone is interested
function getRate(cur)
if ucase(cur) "EUR" then
Dim URL, objXML, objLst, i
URL =
"http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml"
Set objXML = Server.CreateObject("Msxml2.DomDocument")
Set objLst = Server.CreateObject("Msxml2.DomDocument")
objXML.setProperty "ServerHTTPRequest", True
objXML.async = False
objXML.Load(URL)
If objXML.parseError.errorCode = 0 Then
Set objLst =
objXML.getElementsByTagName("Cube/Cube/Cube")
noOfHeadlines = objLst.length
For i = 0 To (noOfHeadlines - 1)
set atribs = objLst.item(i).attributes
if atribs.item(0).text = Ucase(cur)
then
getRate =
atribs.item(1).text
end if
set atribs = nothing
Next
else
getRate = 99999.99
End If
Set objLst = nothing
Set objXML = nothing
else
getRate = 0.0
end if
end function
Regards
Sam Morgan
WiredEyes Media / ServWise Advanced Hosting
tel (Uk): +44 (0)20 7100 2178
tel (Italy): +39 070 773 6543
web : www.wiredeyes.com / www.servwise.com
----
umop ap!sdn w,! aw dlaH
|
 |
|