XSL Stylesheets Dress Up the Output
As I mentioned previously, using Python's print statement in conjunction with simple command-line redirection makes it easy to send the output XML document to wherever you'd like. Unfortunately, the following generic XML output is rather tough to read because the tags that the XML binding library implemented aren't specifically named to correspond to the individual data elements in the dictionaries:
<key type="string" value="FileScanner.class" />
<val type="tuple" >
<item type="string" value="C:\\Ant1.5\\lib\\ant.jar" />
<item type="string" value="org/apache/tools/ant" />
<item type="string" value="7/9/2002" />
Fear not, this can be overcome. An XSL stylesheet can format the raw output into tables. The tables (see Figure 1) may not be works of art, but they are easier to read than the raw XML. I'll leave it to you to enhance the look and feel as you see fit.
|Figure 1: XSL Stylesheet Formats Raw Output into Tables|
Powerful Apps, Minimal CodePython's flexible data structures make it easy to create complex data relationships.
Python is an object-oriented language, so you can make use of cutting edge XML binding technology to reduce the coding time and effort it takes to produce XML data tailored to meet your needs.
A wealth of open-source code libraries are available to help bolster Python's out-of-the-box offerings.
Python's powerful libraries and minimalist syntax allow you to write readable, high- octane applications in fewer lines of code than with Java. In this case, the Python port of the auditor takes full advantage of the following features to deliver more robust functionality in far fewer lines of code than the Java auditor did: