XML and Scripting Languages
By Parand Tony Darugar2005-05-18
Active XML documents
Converting XML documents for display is a typical first task in working with XML, and serves as a good introduction to the machinery involved. The real power of XML, however, lies in its ability not only to transmit information, but also to trigger actions based on the transmitted information. We will examine a sample application that uses these active documents to implement simple stock trading rules.
The basic scenario is as follows: a stock quote service will periodically send an XML document with the latest prices and volume for our chosen stocks (in the format of the XML file we have been using thus far). Our application will decide whether to buy or sell based on the stock quotes and a set of rules stored in our database.
For this simple application we will only buy or sell, using the asking price and volume as the criteria. The price and volume will be received from the XML file, and the rules will be retrieved from a MySQL database (see Resources). The rules will be evaluated, and if buying or selling is required, the corresponding command will be issued.
Tutorial Pages:
» Converting XML to HTML
» Simple substitution
» Function-based substitution
» Tree-based processing
» Active XML documents
» Storing tag contents
» Retrieving the rules
» Acting on the rules
» Next steps
» Resources
First published by IBM DeveloperWorks
