The article manages to be both informative and easy to follow - starting with a very concise introduction to what XML is, and followed by some simple examples of IDS 11.10 XML queries and their results. Being readily distracted by shiny things I usually find it difficult to read more than a sentence about XML without my attention wandering.
What follows are some XML publishing notes which will make more sense after you've read the DB2 Mag article..
When an XML VP is required
The article mentions that the only setup step required is add a Virtual Processor of class idsxmlvp. Note that for most XML publishing functions even this step is unnecessary. The XML VP is only required if you plan to use one of the XPATH functions, namely: extract(), extracxmlclob(), extractvalue(), extractxmlclobvalue(), existsnode().
Reporting Connected Sessions to an XML file
How would you use the genxmlqueryhdr() function to query the connected users from the sysmaster and write the output as a valid XML file that can be used by an application?
The following query writes a valid XML file to /opt/docs/ses.xml - to be used by an application server:
output to '/opt/docs/ses.xml' without headings select genxmlqueryhdr("table", "select username,sid,hostname,dbinfo('UTC_TO_DATETIME',connected) as connected from syssessions") || "</xs:schema>" from sysdual;
If you ran this query in dbaccess you would need to remove a couple of blank lines from the beginning of the file for it to be usable. Executed from an application it would work as-is, and without a style sheet you'd see something like this in a browser:
Note that genxmlqueryhdr() puts an <xs:schema> tag at the beginning of the output but not a closing tag, which is why the above query concatenates the closing tag to the end of the output.
sysdual is a new system table in IDS 11.10 which contains exactly one row, created to improve compatibility with other data servers. In previous versions of IDS, to return one row DBA's would typically finish a select statement with something like "... from systables where tabid=1".
If you don't have IDS 11.10 but would like some XML functionality - you might find the AlphaWorks XSLT blade useful.