The bixchange.xml.cgi script (see Usage section below) creates a template from a resource file in a pretty simplistic XML format. Essentially it looks like this:
ID | Description |
---|---|
BXRET | main node |
UNIQRUN | Unique run id |
FILEVAL | Resource name called |
SHOULDBE | Deprecated - ignore |
FIS | Deprecated - ignore |
BLOCKNAME | TEMPLATE section name |
ROW | Row of data |
GENERATED-ON | Date data returned |
DOCUMENT-SOURCE | Normally the site URL |
Example
<?xml version="1.0" ?>
<BXRET>
<UNIQRUN></UNIQRUN>
<FILEVAL>main2</FILEVAL>
<SHOULDBE>main2</SHOULDBE>
<FIS>main2</FIS>
<SUPERCALI>
<TMPL_LOOP NAME="SUPERCALI">
<ROW><INCR> <TMPL_VAR NAME="INCR"> </INCR>
</ROW></TMPL_LOOP></SUPERCALI>
<GENERATED-ON VALUE="<TMPL_VAR NAME="XMLGENON">" />
<DOCUMENT-SOURCE VALUE="http://localhost/perl/bixchange" />
</BXRET>
This is generated from a resource file that looks like this:
[GENERAL]
PAGETYPE=FORM
UNIQRUN=%%BixChange::get_runid();%%
[TEMPLATE SUPERCALI]
INCR=1
[LOOP SUPERCALI2]
DONKEY=monowar
INCR=%%BixChange::_bxstore('INCRNUM', BixChange::_bxstore('INCRNUM')+ 1)%%
NUMREP=2
PARENT=2
GROUP=SUPERCALI
NUMREPPREV=2
NUMREPNEXT=2
It only returns the INCR key because that is the only one specified in the TEMPLATE block.
Usage
perl -T bixchange.xml.cgi f=someresource > ./tmpl/resource-xml.tmpl
And then via browser
http://yoururl.com/cgi-bin/bixchange/bixchange.cgi?f=someresource&tmpl=resource-xml&BXXML=On
Note: That last parameter, BXXML is not part of the 1.8c release. You'll need to get that from CVS repository at present. It will be part of the 1.8d release. It restricts the content-header to 'Content-Type: text/xml' and saves you from having to set the custom_report_header setting when trying to export pure XML. If you don't include that parameter bixchange will use the default custom_report_header setting which normally includes non-XML elements like a DOCTYPE.