Hi All,
After much procrastination I have finally released V1.0.0 of XMLi. This replaces the Beta version I released last February.
It can be found here:
http://sourceforge.net/projects/xmli/
For those of you who do not know XMLi, it is an open source project I work on that provides an easy way to build XML in your RPG programs and Service Programs. There are 28 example programs provided with the code that show how to write XML to program variables, IFS files or standard output. the code is compiled to V5R4, but there are build programs you can call that will rebuild the objects to V5R4, V6R1, or your current release. the build programs will also create the needed directories. Please read the README file in the download for details.
You can use XMLi in 2 ways:
1) You can use the provided procedures to build your xml directly in your program.
Examples are here:
a) Building XML on a variable:
http://code.midrange.com/732d67fd1d.html
b) Building then writing XML to the IFS:
http://code.midrange.com/0a2916fc08.html
2) You can build an XMLi template (which is a xml document) that defines how to build the XML you want, and then you run it.
The template can take up to 64 parameters when called
The template can use SQL statements (including multiple nested statements) which can use parameter markers
The template can run CL commands
The template supports IF, DO-WHILE, DO-UNTIL, FOR, CHOOSE constructs - which support full expressions such as a != ((b + c) * (d - c) / (c + (d - a)))
You can declare variables and use them within templates
You can import templates within templates
You can even define extensions that you build in RPG to expand the XMLi language. I have provided some example extensions to show how you can build them. They include string manipulation (UPPER, lower, concat, substring, xlate), date, time and timestamp manipulation, math operations, and xml processing. But anybody could build an extension in RPG to allow such things as calls to your own service programs or even other opensource tools such as HTTPAPI or MMAIL. In this way, a response from HTTPAPI could be used as an attachment in a mail sent via MMAIL. The recipient list could be retrieved via an SQL statements - all by simply by defining it in the template.
Example templates and results are here, but full examples are included in the download:
a) Using SQL to build the XML then write to the IFS:
http://code.midrange.com/6e4ca0011e.html
The result:
http://code.midrange.com/872e8139d0.html
b) Using Nested SQL queries and parameter markers to build the XML and write to the IFS:
http://code.midrange.com/63241fb4e9.html
The result:
http://code.midrange.com/de5ef2d550.html
c) Example RPG running template b above:
http://code.midrange.com/cd09390933.html
Once a template is loaded it can be run multiple times. It remains loaded until it is unloaded. this allows multiple templates to be loaded at the same time.
The new version has many, many improvements (which I have listed at the foot of this mail).
Please give this tool a try - simply download, restore the XMLILIB library from the save file, add the XMLi directories to your root directory and run some of the examples.
The best way to support our opensource initiatives is to use them. Where I work we use HTTPAPI, FTPAPI, MMAIL, LLIST, FEU and many others. We are fully committed to the RPG opensource community.
Cheers, and have fun!
Larry Ducie
Enhancements since Beta Version:
1) Added support for loading and switching between up to 256 template definitions
2) Added ability to pass template name and up to 64 parameters on call to xmli_runTemplate()
3) Added <xmli:include /> element to allow the include of static xml from a stream file to the template
4) Added <xmli:escape-markup /> element to allow the markup of all output xml within this element to be escaped with entity references
5) Added 4 new xml output formats. Current formats: none, tabbed, simple, pretty, template
6) <xmli:call-handler /> now includes a reset attribute to condition whether to reset the current offset in the memory space back to 0
7) <xmli:write-to-file /> now includes a reset attribute to condition whether to reset the current offset in the memory space back to 0
8) Added <xmli:write-to-stdout /> element to allow writing to standard output. This includes a reset attribute, as above
9) Fixed issue with variable data allocation to allow values to be correctly set for variables at run-time
10) Fixed issue with pre-defined static entity references not transposing to output xml correctly
11) Refactored element data parsing code to make it more efficient
12) Re-engineered the storage of template static resource to considerably enhance runtime performance, and allow for more efficient building of multiple template resources
13) Added <xmli:do-while> looping construct
14) Added <xmli:do-until> looping construct
15) Added <xmli:for> looping construct
16) Enhanced <xmli:leave /> and <xmli:iter /> to support leaving the three new looping constructs in addition to the <xmli:for-each> SQL Result Set looping construct
17) ADDED ABILITY TO PLUG IN XMLI EXTENSIONS - VERY IMPORTANT EHNANCEMENT!!!
18) New xmli XSD Schema Created - add to XML Catalogue in RDi to validate the XMLi template
19) Modified the xmli template root tag to be written as either <xmli-template> (original) or <xmli:template> (preferred)
20) Added <xmli:space> and <xmli:crlf>
21) Re-engineered conditional test to provide a more intuitive interface and compound tests
22) added <xmli:choose> conditional construct
23) Re-engineered conditional testing to support full expressions
As an Amazon Associate we earn from qualifying purchases.