Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 2.2

COLUMN

From Scratch: Finishing StocksSocket

Issue: 2.2 (October/November 2003)
Author: William Leshner
Author Bio: William Leshner has been programming for twenty years and programming Macs for ten. He has spent a good deal of the last several years building REALbasic applications, including the now famous ResPloder.
Article Description: No description available.
Article Length (in bytes): 11,111
Starting Page Number: 40
Article Number: 2219
Resource File(s):

Download Icon 2219.zip Updated: 2013-03-11 19:07:57

Related Web Link(s):

http://content.nasdaq.com/logos/AAPL.GIF<
http://www.w3.org/DOM/

Excerpt of article text...

This is the second in a series of three articles in which we are creating StocksSocket, a subclass of HTTPSocket that obtains stock information from a NASDAQ XML feed. As we discussed in the last article, we can query a NASDAQ server for stock information and the server returns the results as XML. Our StocksSocket will take care of querying the server and parsing the resulting XML. For each stock in the XML, StocksSocket will add the attributes for that stock to a dictionary and then pass the stock symbol and the dictionary to a New Event we called StockReceived. In this article we will talk about how to parse the XML we get from the NASDAQ server and how to pass the result to the StockReceived event.

One word of caution: I had to make a few changes to SimpleXmlParser. It seems that NASDAQ made a minor modification to their XML feed and I had to modify the parser to handle the change. This is a good thing, actually. The current incarnation of SimpleXmlParser should be more robust.

Stock XML

Before we start writing code, let's take a look at a bit of the XML that the NASDAQ server returns as a response to a stock query. Consider this snippet of XML that I obtained from a query for the stock symbol "AAPL":

<nasdaqamex-dot-com>

...End of Excerpt. Please purchase the magazine to read the full article.