Username Password
Bookmark and Share

XMLTemplate (Wobject)

The XMLTemplate Wobject is a beta project which I wrote for the purpose of giving myself a WebGUI interface for displaying simple XML as HTML.  Basically, it allows you to upload an XML document, or point to one on the web and then display the data inside an HTML Template that you can define.

My original plan was to link an XML document to an XSLT spreadsheet, however I could not find a good XSLT parser written in PERL.

Thus the XMLTempate wobject was born.

This Wobject is far from finished, however I am posting it here for 2 reasons:
First and foremost, it does work with simple xml documents providing and easy solution for displaying xml data in html format

Second, I'd really like to complete the project, however I don't have the time right now.  Considering that, as it stands, it meets my needs I probably never will.  My hope is that someone will pick up where I left off and finish or add to it.

Some Ideas that I have that I don't have time to implement:
- get nested loops working.
- Implementing <IF>/<ELSEIF>/<ELSE> statements (started)
- Allowing the inclusion of XSLT stylesheets instead of an HTML template.
- Possibly implementing a better XML parser
- WebGUI macro processing for more powerful templates
- Possible integration with the current WebGUI Template engine.
- Adding xml file filtering and HTML Template validation to make it more error proof.
- anything else you can think of!

Anything you'd like to contribute to this project would be great!  I think this Wobject has real potential, and can be extremely useful.  I realize that this is far from completed,
and not really practical for use with business level xml data, but
I hope that it is of use to some and fun to tinker with for others.

Please send me any contribution you make and I'll update the downloads section.
As of now, the work is not internally documented.  If you have questions, feel free to send me an email.

- You will first need to install the XML-Simple Perl Module (this is included in the ActiveState ActivePerl 5.8.0 distribution)
- Unzip into your /WebGUIRoot directory.
- Navigate to /WebGUIRoot/docs and run the sql script create-XMLTemplate-0.1.0.sql
- You should now be able to create a new XMLTemplate.
- Have fun!

How to use the XMLTemplate:
- Create a new XMLTemplate wobject as you would any other wobject.
- In the "XML Data Source" field, either choose an xml file from your system, or type in the URL of the xml document you'd like to use.
- In the "HTML Template for XML Data" Area, create your html.  To use the date from your XML file, follow the following simple xml tags I have defined:

(The xml document root is always ignored)

Access an XML Element:

Access an Element Attribute

Process a Loop
<loop element="elementToLoopOver">

Here's an example.  Please note that this is a made up XML document:

<?xml version="1.0" ?>
  <information summary="Purchases made outside the retail store"/>
  <client name="Sue" surname="Summers" phone="555-2345" title="Vice President" email="">
     <purchase type="Cash" id="163750" total="$45.00"/>
     <salesman>Brian Johnson</Salesman>
  <client name="Joe" surname="Jackson" phone="555-2878" title="Purchasing Agent" email="">
     <purchase type="PO" id="25462321" total="$300.00"/>
     <salesman>Brian Johnson</Salesman>

Template to display this data:
      <td>Client Name</td>
      <td>Client Phone Number</td>
      <td>Client Email Address</td>
   <loop element="client">  
         <td><xml>name</xml> <xml>surname</xml></td>

System RequirementsPlease be advised: this contribution was tested with something older than WebGUI 7.5. When this contribution was uploaded there was no field for the author to fill out regarding it's requirements.
4ehab: "
IS this compatible with 5.1.2, i tried it and it gives error in the log file  meaning it can not create the new object when i try to create an xml wobject after i enter the data.


Ehab Heikal

Quote: An eye for an Eye only helps make the whole world blind


4ehab: "
The object worked perfectly my installation was flawed, there are a lot of dependancies for XML::Simple take care.

Ehab Heikal

Quote: An eye for an Eye only helps make the whole world blind


LinksNo Support Offered
Statistics Downloads: 774
Views: 5938
Rating: 4
Updated: 8/12/2005
Keywords Assets Templates
NavigationBack to the Bazaar
© 2022 Plain Black Corporation | All Rights Reserved