Page is a not externally linkable
- Code, Content, and Presentation
-- XML Development
---- Scraping data from an RSS feed


httpwebwitch - 8:11 pm on Oct 9, 2008 (gmt 0)


for the benefit of the group
river_east is scraping data out of an XML node that looks like this:
<title>1 USD = CAD (1.124512)</title>

* * *

so. what is returned from getCurrency("CAD") ?

I don't see anything glaringly wrong with the function. Nothing obvious anyways.

debugging tip: inject little debugging one-liner commands into your script and echo out variables to see what their values are.

for instance, echo out "objItem.childNodes( 0 ).text" and see if it is what you expect.
Then echo out "Mid( objItem.childNodes( 0 ).text, 1, 11 )". Take the code in little chunks and verify that it's doing everything right from top to bottom.

It may be something as simple as a bad boundary limit in the Mid() or Left() string functions.

Also, you may consider using a regular expression to extract the data instead of awkwardly nested substring functions.


Thread source:: http://www.webmasterworld.com/xml/3762219.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com