Datasheet
setValue(‘yahoofinance.quotes.open’, tree.quote.open);
setValue(‘yahoofinance.quotes.high’, tree.quote.high);
setValue(‘yahoofinance.quotes.low’, tree.quote.low);
setValue(‘yahoofinance.quotes.volume’, tree.quote.volume);
}
}
}
In addition to the differences of syntax between PHP and JavaScript, there are also differences in the
libraries used to manipulate XML as objects. One difference is that in PHP, SimpleXML merges the root
element and the document itself (you write
$quote->high); this is not the case with JKL.ParseXML
(you write
tree.quote.high). You would find more differences in more complex functions such as
the one that displays RSS channels, but the PHP and JavaScript versions are still very close. After this
update, BuzzWatch is more accessible and you can see information in the pages if you try again to access
http://localhost/buzzwatch/?name=jw-a using Lynx, as you can see in Figure 1-5.
Figure 1-5
Making BuzzWatch More Maintainable
To make a good web citizen out of BuzzWatch, you had to develop a set of functions twice, in two differ-
ent languages. The number of lines affected by this duplication is low (about 120 lines in PHP) and you
may think that this isn’t a big deal. On the other hand, if BuzzWatch is successful, it will probably grow
28
Chapter 1
04_087889 ch01.qxp 5/2/07 12:56 PM Page 28