The scope of this article includes XML and it's interaction with Uniface. For illustration purposes we will use a XHTML web page that link with a Uniface web page. The XHTML will format and display the Uniface web page set up as a XML source.
Remember than XML and HTML both derive from the SGML (ISO8879), which was defined in 1986 as an international standard for document mark-up. The first HTML specification was published by the W3C in 1992 as a mark-up language specific to web pages.
XML is an extensible mark-up language. With XML, you can define your own set of tags by means of a DTD. Everybody knows that the limitation of HTML is that it has a fixed set of tags.
Application areas of XML are:
The problem so far is that HTML was originally designed to represent a presentation structure of a document, which would have such structural parts as a header, a title, a paragraphs, an so on, so its tags were designed for this purpose. However, HTML does not include tags to represent logical data, to extract data from an HTML page, we need to embed the data in a document-oriented tag.
With XML, we can define a structure that directly represents data, in our example the data will be all the messages stores in the Uniface repository.
The next code is a XML document describing a typical Spanish meal, the Paella Valenciana.View picture !
<?XML version="1.0" standalone="yes"?> <MENU> <NAME>PAELLA</NAME> <PEOPLE>4</PEOPLE> <INGREDIENTS> <RISE AMOUNT="2" UNITS="KG"/> <WATER AMOUNT="2" UNITS="LT"/> <MEAT TYPE="CHICKEN" AMOUNT="0.5" UNITS="KG"/> <MEAT TYPE="RABBIT" AMOUNT="0.5" UNITS="KG"/> <OLIVE_OIL AMOUNT="0.2" UNITS="LT"/> </INGREDIENTS> <ELABORATION> <STEP NUMBER="1" DESCRIPTION="BLA,BLA,BLA" /> </ELABORATION> </MENU>
This XML document is a logical representation of the user data; this representation is independent of the page representation structure and thus of how it will display on screen.
But we all the tags need to be defined in the application’s grammar called a Document Type Definition DTD. This DTD would be published and thereby be made available to anyone wanting to use this XML output.
An XML document must to follow a set of rules, the most important are:
A document constructed according to the previous simple rules is known as WELL-FORMED documents. However SGML uses the DTD to describe the mark-up elements in any specific type of document, but write this DTD can be complex and non-trivial task, so XML has been designed to live with or without DTD.
At least all XML documents both DTDless and Valid must be Well Formed.
<?XML version="1.0" standalone="yes"?>
<?XML version="1.0" standalone="yes"?> <!DOCTYPE SYSTEM A HREF="http://www.your.com/dtd/test.dtd">
Because XML elements have no default appearance, we need to assign one, so the most basic way to render XML is to translate it into HTML.
Under Microsoft Explorer 5, you can use the <XML> tags, with SCR attribute
<XML scr="test.XML></XML>
<SCRIPT LANGUAGE="XML" TYPE="text/XML">
However, you may want to use CCS to display XML content but, because the lack of flow object make CSS very difficult to do this task, so many web experts look to XSL as a possible solution.
XLS, a much more complex language than CSS, is based on DSSSL that was used in the SGML community; one of the most interesting aspects of XLS is its complex pattern matching. You can write XSL rules that match various pieces of a XML file and then output the appropriate HTML and/or CSS to display the information.
Have a quick look to another example with a fully DTD about a restaurant MENU specification ,so all the implied part in the restaurant chain know what about they are talking.
<?XML version="1.0"?> <!DOCTYPE MEAL [ <!ELEMENT MEAL (COURSE+)> <!ELEMENT COURSE EMPTY> <!ATTLIST COURSE NAME CDATA #REQUIRED TYPE CDATA #REQUIRED LEVEL (1|2|3|4|5) PRICE CDATA #REQUIRED> <!ATTLIST MEAL DATA CDATA #REQUIRED CHEF CDATA #REQUIRED> ]><!—the documment instance --à <MEAL> <COURSE NAME="SALAD" TYPE="FIRST COURSE" LEVEL="8" PRICE="600" /> <COURSE NAME="PAELLA" TYPE="MAIN COURSE" LEVEL="9" PRICE="2000" /> <COURSE NAME="ICE CREAM" TYPE="DESSERT" LEVEL="6" PRICE="200" /> <DATE>06/06/2000</DATE> <CHEF>MR. RED</CHEF> </MEAL> <MEAL> .... </MEAL>
Currently Uniface 7/8 generate non-valid well-formed XML documents because the XML support is limited.
Look at UNIFACE support for DTD and XML syntax or Download Uniface XML.PDF
Document Type Definitions (DTD) and Repository support DTDs are not yet supported.
Also, the supported XML format is limited in structuring Repository data;
everything is exported on a table by
table basis.
This is an example of Uniface non-valid but well-formed document:
<?XML version='1.0' ?> <!-- Created by Uniface - (C) Compuware Corporation --> <Uniface release="5.3" XMLengine="1.0"> <TABLE XMLns:UFORM="UFORM.DICT"> <DSC name="UFORM" model="DICT" system="S" pseudo ="73" level="1" noupdate="0" rbk="0" ffsql="0" transnr="0" segsize="0" ufocc="1000" charset=".U"> <FLD name="UTIMESTAMP" seqno="1" type="E" level="2" pack="0" scale="32" length="15" pointer="0" inum="0" ufocc="0" /> <FLD name="UCOMPSTAMP" seqno="2" type="E" level="2" pack="0" scale="32" length="15" pointer="0" inum="0" ufocc="0" /> <FLD name="ULABEL" seqno="3" type="S" level="2" pack="0" scale="100" length="16" pointer="0" inum="1" ufocc="0" mandatory="yes" idxnum="1" idxsnr="101" /> <FLD name="FTYP" seqno="4" type="S" level="2" pack="0" scale="100" length="4" pointer="0" inum="0" ufocc="0" />
And this is how explorer 5.5 read this:
However we are lucky that next Uniface release 7.2.6 will generate DTD, using a new editor plus a new XML stream parameter and two new proc statement to use XML streams inside our components XMLsave and XMLload . Plus a new proc statement retrieve/reconnect . Interesting times await us !
Build your Uniface web forms as usual, choose the entities and the fields that you want to use, then in the component html properties of the form set the layout style to XML DATA.
The second step is write a XHTML document that uses the Uniface server page as a source and format the XML data usign XLS.
The above example uses the Microsoft’s XML data island, that mean a way to embedding XML into html documents, the idea is use a <XML>elements to encode <XML> content while the "official" XML syntax remains unclear. :-(
The overall of this example is just show how you can create an information source (XML) and how the data is represented (DTD) and share it to 3er party organisations as a black box.
The crucial line:
<XML id="source" src="http://localhost/urd/uniface.urd/web_usource.exec">
So, now: install a web server (not IIS :), configure uniface and run the xhtml form, the final result will look something like:
Author: Carles Zaragoza
E-Mail: mailto:carlesz@yahoo.com
Version: 1.0 June 2000
To request a PDF version just send me an email.