XML and Scripting Languages
By Parand Tony Darugar2005-05-18
Acting on the rules
Each stock quote is contained within a stock_quote tag. By the time the end tag for stock_quote is reached, all of the necessary information has been stored (the stock symbol, price, and volume). Thus we can act on the rules in the
stock_quote_ function: |
The applicable rules for the given stock symbol are retrieved, and the comparison is performed. If the rule applies, the take_action function is called, which in this case is simply a stub.
The complete program is available as a separate listing, as well as the schema for creating the rules table. Running the program with the original XML file produces the following output:
|
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
