April 1, 2002 - The Web Service XML Response | WebReference

April 1, 2002 - The Web Service XML Response

Yehuda Shiran April 1, 2002
The Web Service XML Response
Tips: April 2002

Yehuda Shiran, Ph.D.
Doc JavaScript

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>
Learn more about consuming the StockQuote Web service from Column 105, Web Services, Part X: Consuming the StockQuote.