Online documentation - Websydian v6.1 |
XML Generators are Page Generators generating XML documents instead of HTML pages. Generation of XML documents is based on XML Document Templates in exactly the same way that normal HTML page generation is based on HTML Document Templates.
Generation of XML documents will most often require a structure of nested XML Generators calling each other, which is implemented by inheritance from the ChildPageGenerator pattern.
An example is given below on how to specify the generation of an XML document containing a list of Categories and for each Category listing the Products belonging to the Category.
The Parent XML Generator is the function which is called in order to produce the XML document, and the Parent XML Generator may then call other Child XML Generators. In the example below, XmlCategoryList is the Parent XML Generator and XmlProductSubList is a Child XML Generator.
Example:
XmlCategoryList | is a FNC | XmlGenerator GridPage |
comprises FNC | XmlProductSubList | |
replaces VW ...by VW |
UIBasic.Grid Category.Fetch |
|
impl name NME | XmlCat | |
file name NME | XmlCat |
The XmlGenerator pattern is itself a ParentPageGenerator, so this inheritance does not need to be specified.
In the example, the XmlProductSubList Child XML Generator is comprised by the Parent generator. The Child generator could as well have been scoped under the XmlCategoryList function by a FNC includes FNC triple.
The XmlProductSubList Child XML Generator is supposed to list the Products belonging to a Category, and it will be called for each Parent record generated by the XmlCategoryList Parent XML Generator.
Example:
XmlProductSubList | is a FNC | XmlGenerator ChildPageGenerator GridPage |
replaces VW ...by VW |
UIBasic.Grid Product.ProductsByCategory |
|
replaces FNC ...by FNC |
UIBasic.Grid.BlockFetch Product.ProductsByCategory.BlockFetchSet |
|
option NME ...value SYS |
GridChild Yes |
|
impl name NME | XmlProd | |
file name NME | XmlProd |
The GridChild option specifies that the function replacement marker for the Child generator will be inserted within the Grid markers in the generated XML Document Template of the Parent generator.
Child XML Generators may themselves be Parent generators calling other Child generators.
Generation of the XML document is performed by calling a Dispatcher function from the Web browser. If a Dispatcher function has already been specified and a Web server alias has been defined, a call to the Parent XML generator needs to be inserted into the CallFirstPageGenerator function scoped under the Dispatcher.
Generate and build the Dispatcher function and the two XML Generator function.
Parameter mapping warnings may appear when generating the Parent XML Generator. When a Parent generator calls a Child generator, actual parameter mapping will be taken from the WsyDetails or WsyGrid variables. If the corresponding fields do not exist in these variables, warnings will be generated during generation and a blank value will be mapped at run-time.
From the Generate and Build window, run the _XmlTemplateGenerator function scoped under the two XML Generator functions.
The generated XML Templates can be found in the HTML folder (where generated HTML Document Templates also are located). The Template documents may be opened and modified with Notepad or another text editor.
Example:
The generated XML Template documents may be opened and modified in Notepad or another text editor. For instance, the Details part of the XML Template may be deleted.
By modifying the XML templates of the various XML generators, it is possible to make the generated XML documents fit any DTD (Data Type Definition) for XML documents.
In the last step, the XML generation is run from a Web browser by calling the Dispatcher function.
Example:
Generation of XML document called from Web browser.
The Parent XML Generator may be modified to save the generated XML document in a file.