spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column105


Web Services, Part X: Consuming the StockQuote

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

Justtechjobs.com Post A Job | Post A Resume
Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs


Interpreting the XML Response

Web services respond in XML. The StockQuote Web service responds with 16 different data elements for each trade symbol. Each data item is enclosed within a separate tag. For example, the <High> tag includes the high value of the symbol during the current trading session:

<High>64.70</High>

The market capitalization is denoted by the <MktCap> tag. Notice that the data includes the units of measures (B for Billions):

<MktCap>346.3B</MktCap>

Here is an example listing of the XML response for the symbols YHOO, IBM, and MSFT:

<StockQuotes>
  <Stock>
    <Symbol>YHOO</Symbol>
	<Last>18.93</Last>
	<Date>3/8/2002</Date>
	<Time>4:00pm</Time>
	<Change>+0.99</Change>
	<Open>18.44</Open>
	<High>18.98</High>
	<Low>18.05</Low>
	<Volume>9506500</Volume>
	<MktCap>11.006B</MktCap>
	<PrevClose>17.94</PrevClose>
	<pctChg>+5.52%</PctChg>
	<AnnRange>8.02 - 24.4375</AnnRange>
	<Earns>0.07</Earns>
	<P-E>256.29</P-E>
	<Name>YAHOO INC</Name>
  </Stock>
  <Stock>
    <Symbol>IBM</Symbol>
	<Last>105.09</Last>
	<Date>3/8/2002</Date>
	<Time>4:02pm</Time>
	<Change>+1.38</Change>
	<Open>104.82</Open>
	<High>107.34</High>
	<Low>104.82</Low>
	<Volume>10708000</Volume>
	<MktCap>181.0B</MktCap>
	<PrevClose>103.71</PrevClose>
	<pctChg>+1.33%</PctChg>
	<AnnRange>87.49 - 126.39</AnnRange>
	<Earns>4.35</Earns>
	<P-E>23.84</P-E>
	<Name>INTL BUS MACHINE</Name>
  </Stock>
  <Stock>
    <Symbol>MSFT</Symbol>
	<Last>63.95</Last>
	<Date>3/8/2002</Date>
	<Time>4:01pm</Time>
	<Change>+1.23</Change>
	<Open>63.63</Open>
	<High>64.70</High>
	<Low>63.17</Low>
	<Volume>28780100</Volume>
	<MktCap>346.3B</MktCap>
	<PrevClose>62.72</PrevClose>
	<pctChg>+1.96%</PctChg>
	<AnnRange>47.50 - 76.15</AnnRange>
	<Earns>1.09</Earns>
	<P-E>57.54</P-E>
	<Name>MICROSOFT CP  </Name>
  </Stock>
</StockQuotes>


Next: How to convert the XML response to HTML

http://www.internet.com

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: March 11, 2002
Revised: March 11, 2002

URL: http://www.webreference.com/js/column105/5.html