SourceForge.net Logo







XDFL language reference
XDFL Reference documentation
XDFL Reference documentation
Version 1.1 - 14/09/2004 - Guillaume BAURAND -
Table of contents
I. core - Builtin XDFLengine functionnalities.

I. core
Builtin XDFLengine functionnalities.

1.1. Core parsed expressions

Parsed expressions are substitution clauses inserted into XML input stream. These clauses are of the form @@[PREFIX:argument]@@ where PREFIX designates the type of parsed expression. As the document is being processed, they are replaced by their calculated values.

1.1.1. @@[DATE:format]@@ : insertion of the current date in various formats

Expressions of type DATE: permit insertion of the current date in various formats, indicated by the argument
Interface
Parameters
NameTypeDescription
formatstringIndicates the format of the date to insert
ValueDescription
userDate is inserted in a human-readable format (dd/mm/yyyy hh:mm:ss).
fileDate is inserted in format adapted for file name generation (yyyymmdd_hhmmss).
sqlDate is inserted in format adapted for database use (yyyy-mm-dd hh:mm:ss).

1.1.2. @@[ENV:env_var]@@ : insertion of the value of an environmental variable

Expressions of type ENV: permit insertion of the value of an environmental variable whose name is indicated by the subscription section
Interface
Parameters
NameTypeDescription
env_namestringIndicates the name the environmental variable to insert

1.1.3. @@[VAL:variable]@@ : insertion of the value of a XDFL variable

Expressions of type VAL: permit the value of the named variable indicated in the argument to be retrieved.
Interface
Parameters
NameTypeDescription
variablestringIndicates the name the variable to insert

1.1.4. @@[BUF:buffer_name]@@ : insertion of the content of a XDFL buffer

Expressions of type VAL: permit the content of the named buffer indicated in the argument to be retrieved.
Interface
Parameters
NameTypeDescription
buffer_namestringIndicates the name the variable to insert

1.2. Core language functionnalities.

1.2.1. * : Common tag parameters

These parameters are available for every XDFL node.
Interface
Parameters
NameTypeDescription
enclosestringIndicates the name of a tag enclosing the output of the current node
ValueDescription
No tag enclosing output
enclose_cdatabooleanIndicates that the output is enclosed in a CDATA section
ValueDescription
0(default) - The ouput is not enclosed in a CDATA section
1The ouput is enclosed in a CDATA section
error_fatalbooleanIndicates that the errors thrown by node or its descendants are not fatal
ValueDescription
0(default) - Errors are not trapped. The execution of this node is stopped by any untrapped error sent by this node or its descendants
1Errors are trapped
outputstringIndicates the output stream destination
ValueDescription
(parent)(default) - The output stream is sent to the parent node
(none)The output stream is discarded
[string]The name of an existing buffer to redirect the output stream in. The named buffer must exist
output_errorstringIndicates the error output stream destination. The error output stream is generated when an error occurs and is trapped
ValueDescription
(none)(default) - The error output stream is discarded
(parent)(default) - The error output stream is sent to the parent node
[string]The name of an existing buffer to redirect the output stream in. The named buffer must exist
commentstringIndicates a string to be written to the log at the beginning of the execution of this node
ValueDescription
(default) - Nothing is written to the log
contextstringIndicates the execution context in which the node is executed
ValueDescription
(CURRENT)(default) - The node is executed in current context
(PARENT)The node is executed is the parent context of current context
APPLICATIONThe node is executed is the application context
SCRIPTThe node is executed is the script context
SUBSCRIPTThe node is executed is the subscript context, ie the context of a script called from another script
MODULEThe node is executed is the module context
OBJECTThe node is executed is the object context

1.2.2. _ALIAS : Active node aliasing

The _ALIAS node assigns a new name for an XDFL node : the aliased node can be accessed using its original name or the alias.
Interface
Parameters
NameTypeDescription
name*stringThe tag of XDFL node to be aliased
alias*stringThe alias to create
Side effects
Creates an alias for the tag given as parameter.The aliased node can be accessed using its original name or the alias
Samples
Pluggable module loading and aliasing.
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- loadingthe dynamic library -->
<xdfl:_MODULE_LOAD path="../../build/win32.1.0/sampleModuleStreamer_win32.1.0.dll" />
<!-- creating alias -->
<xdfl:_ALIAS name="SAMPLEalias="SAMPLE2" />
</XDFL>

1.2.3. _MODULE_LOAD : External module load

The _MODULE_LOAD node loads a dynamic library and imports XDFL nodes from it. Imported nodes can then be used as normal nodes.
Interface
Parameters
NameTypeDescription
path*stringThe path of the library to load. For unix the library file is provided without the extension (.so or .sl). For windows the full name of the library is provided
Side effects
The library is loaded in the XDFLengine memory space and the XDFL nodes are imported. Imported nodes can then a used as normal nodes.
Comments
Dynamic loading dependencies
If the loaded library is dependant upon other libraries, these libraries must be located in a directory which path is contained in the dynamic libraries search path.
Samples
Pluggable module loading and aliasing.
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- loadingthe dynamic library -->
<xdfl:_MODULE_LOAD path="../../build/win32.1.0/sampleModuleStreamer_win32.1.0.dll" />
<!-- creating alias -->
<xdfl:_ALIAS name="SAMPLEalias="SAMPLE2" />
</XDFL>

1.2.4. BUF_GET : Getting the value of named buffer

The BUF_GET node reads the data contained in a named buffer and write it to its output.
Interface
Parameters
NameTypeDescription
name*stringThe name of the buffer to read
Output
The data of the named buffer
Samples
Using BF_GET and BUF_SET
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- création of a first buffer -->
<xdfl:BUF_SET name="buffer1create="1" >
<data attribute="value" >
<more_xml_data />
</data>
</xdfl:BUF_SET>
<!-- writting first buffer to output -->
<xdfl:OUTPUT >
  
buffer1:
<xdfl:BUF_GET name="buffer1" />
</xdfl:OUTPUT>
<!-- creation of a second buffer -->
<xdfl:BUF_SET name="buffer2create="1" >
<XML >
<!-- copy the first buffer in the second one -->
<xdfl:BUF_GET name="buffer1" />
</XML>
</xdfl:BUF_SET>
<!-- append data in the first buffer -->
<xdfl:BUF_SET name="buffer1" >
<even_more_xml />
</xdfl:BUF_SET>
<!-- creation of a third buffer -->
<xdfl:BUF_SET name="buffer3create="1" />
<!-- writtung the content o the first buffer in the third one -->
<xdfl:BUF_GET name="buffer1output="buffer3" />
<!-- output second and third buffer -->
<xdfl:OUTPUT >
  
buffer2:
<xdfl:BUF_GET name="buffer2" />
buffer3:
<xdfl:BUF_GET name="buffer3" />
</xdfl:OUTPUT>
</XDFL>

1.2.5. BUF_SET : Writting to a named buffer

The BUF_SET writes its input stream to a named buffer.
Interface
Input
An XML of non-XML stream
Parameters
NameTypeDescription
name*stringThe name of the destination buffer.
createbooleanIndicates whether the named buffer is to be created or not. If not the named buffer must exist.
ValueDescription
0(default) - The named buffer already exists and is not created
1A new empty buffer with the provided name is created. If a buffer with that name already exist, it is discarded.
typestringIndicates the type of buffer to create. This parameter is ignored if create=0.
ValueDescription
mem(default) - The named buffer is created as a memory buffer.
fileThe named buffer is created as a file buffer.
filestringIndicates the path file on which the buffer is mapped, in case of a file buffer creation. When tis parameter is specified, the file is not deleted upon buffer deletion.
Output
The input stream
Side effects
Input data is written to the buffer. If create=1, the buffer is previouly created.
Samples
Using BF_GET and BUF_SET
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- création of a first buffer -->
<xdfl:BUF_SET name="buffer1create="1" >
<data attribute="value" >
<more_xml_data />
</data>
</xdfl:BUF_SET>
<!-- writting first buffer to output -->
<xdfl:OUTPUT >
  
buffer1:
<xdfl:BUF_GET name="buffer1" />
</xdfl:OUTPUT>
<!-- creation of a second buffer -->
<xdfl:BUF_SET name="buffer2create="1" >
<XML >
<!-- copy the first buffer in the second one -->
<xdfl:BUF_GET name="buffer1" />
</XML>
</xdfl:BUF_SET>
<!-- append data in the first buffer -->
<xdfl:BUF_SET name="buffer1" >
<even_more_xml />
</xdfl:BUF_SET>
<!-- creation of a third buffer -->
<xdfl:BUF_SET name="buffer3create="1" />
<!-- writtung the content o the first buffer in the third one -->
<xdfl:BUF_GET name="buffer1output="buffer3" />
<!-- output second and third buffer -->
<xdfl:OUTPUT >
  
buffer2:
<xdfl:BUF_GET name="buffer2" />
buffer3:
<xdfl:BUF_GET name="buffer3" />
</xdfl:OUTPUT>
</XDFL>

1.2.6. GET : Getting the value of a variable

The GET node reads the value of a variable and outputs it to its output.
Interface
Parameters
NameTypeDescription
val*stringThe name of the variable to read
Output
The value of the variable

1.2.7. IF : conditionnal execution

This node carries out a comparison between val1 and val2 using the op operator. If the result is 'false', the sub-tree is not activated and generates no stream. If the condition is true, the sub-tree executes normally and the active IF node returns the stream issued by the sub-tree.
Interface
Input
An XML of non-XML stream
Parameters
NameTypeDescription
val1*stringThe first term of the comparison
val2stringThe second term of the comparison
ValueDescription
1(default) -
opstringThe comparison operator
ValueDescription
streq(default) - alphanumeric equality
strnealphanumeric inequality
inalphanumeric inclusion
eqnumeric equality
nenumeric inequality
gtgreater than
gtegreater or equal
ltlower than
ltelower or equal
Output
If the condition is true, the input stream, else, nothing
Samples
Difference beetween IF and PASSIVE
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<xdfl:OUTPUT >
<xdfl:PASSIVE >
<some_xml >
<and_some_more />
<!-- This variable will not be taken in consideration -->
<xdfl:VAL name="onevar1value="data1" />
<!-- This block will not be compiled : no error will be sent for this unvalid tag-->
<xdfl:THIS_XDFL_TAG_DOES_NOT_EXIST />
</some_xml>
</xdfl:PASSIVE>
<!-- False condition -->
<xdfl:IF val1="1val2="0op="eq" >
<will_not_be_displayed >
<xdfl:VAL name="onevar2value="data2" />
</will_not_be_displayed>
</xdfl:IF>
<!-- True condition -->
<xdfl:IF val1="1val2="1op="eq" >
<will_be_displayed >
<xdfl:VAL name="onevar3value="data3" />
</will_be_displayed>
</xdfl:IF>
	
		
onevar1 : @@[VAL:onevar1]@@
onevar2 : @@[VAL:onevar2]@@
onevar3 : @@[VAL:onevar3]@@

	
</xdfl:OUTPUT>
</XDFL>

1.2.8. LOG : Stream interception / logging

This active node enables a stream to be intercepted and written to a log file.
Interface
Input
An XML of non-XML stream
Output
The input stream
Side effects
Writes the input stream to log
Samples
Using LOG, INPUT and OUTPUT
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- 3/ Outputing input data -->
<xdfl:OUTPUT >
<!-- 2/ Logging input data -->
<xdfl:LOG >
<!--1/ Getting input data -->
<xdfl:INPUT />
</xdfl:LOG>
</xdfl:OUTPUT>
</XDFL>

1.2.9. NULL : 'nop' tag

The NULL tag does nothing and outputs the data it receives in input.
Interface
Input
An XML of non-XML stream
Output
The input stream
Samples
Using NULL
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- creating a buffer -->
<xdfl:BUF_SET name="buffercreate="1" />
<xdfl:OUTPUT >
<xdfl:NULL >
<some_xml >
<blah />
...
<blah />
...
<blah />
</some_xml>
</xdfl:NULL>
<!-- writting to the buffer -->
<xdfl:NULL output="buffer" >
<some_more_xml >
<data />
</some_more_xml>
</xdfl:NULL>
<!-- output buffer's content -->
buffer:
		
<xdfl:BUF_GET name="buffer" />
</xdfl:OUTPUT>
</XDFL>

1.2.10. RAISE_ERROR : Error raising

The RAISE_ERROR node raises an error
Interface
Parameters
NameTypeDescription
numberintegerNumber of the error to be raised. The error number must be something other than 0 for an error to be raised
ValueDescription
0(default) - No error is raised
messagestringThe error message
fatalbooleanIndicates whether the error is fatal or not
ValueDescription
0(default) - The error is not fatal
1The error is fatal
Side effects
If the error number is anything other than 0, the error with the specified number is raised, with the specified message.
Samples
Raising an error
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- Raising an error -->
<xdfl:RAISE_ERROR number="666message="Catastrophic failure" />
</XDFL>
Catching an error
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<xdfl:BUF_SET name="error_buffercreate="1" />
<!-- The NULL tag allows to catch the error -->
<xdfl:NULL error_fatal="0output_error="error_buffer" >
<!--The VAL node expects an input document -->
<!-- Finding two nodes, it will raise an error -->
<xdfl:VAL >
<docroot1 />
<docroot2 />
</xdfl:VAL>
</xdfl:NULL>
<!-- Getting values from error buffer -->
<xdfl:VAL >
<xdfl:BUF_GET name="error_buffer" />
</xdfl:VAL>
<xdfl:OUTPUT >
<xdfl:BUF_GET name="error_buffer" />
The error Nb:@@[VAL:ERROR.number]@@ has occured : @@[VAL:ERROR.message]@@
	
</xdfl:OUTPUT>
</XDFL>

1.2.11. RAW : Raw content extraction

The RAW node returns only the text content found in the XML tree supplied as input.
Interface
Input
An XML stream.
Output
The textual content found in input stream (TEXT and CDATA sections).

1.2.12. SPLIT : Iteration on child nodes in an XML document

The SPLIT node repeats the execution of the immediate parent node for each subtree of the input XML stream at specified depth.Each documents sent to the parent node consists in the subtree and its ancestors.
Interface
Input
An XML stream.
Parameters
NameTypeDescription
levelintegerThe depth at which the subtrees are split.
ValueDescription
1(default) -
Output
As many XML streams are there are subtrees at specified level.
Side effects
The execution of the immediate parent node is repeated for each subtree of the XML input stream.

1.2.13. SEQUENCE : Repeated execution of child nodes.

The SEQUENCE node produces a sequence of XML tags and repeats the execution of the immediate parent node.
Interface
Parameters
NameTypeDescription
minintegerStarting value of the sequence.
ValueDescription
0(default) -
maxintegerEnding value of the sequence. If this parameter is lower than the 'min', the loop will iterate forever.
ValueDescription
-1(default) -
stepintegerIteration step.
ValueDescription
1(default) -
tagstringThe name of the xml tag geneated for each iteration.
ValueDescription
iteration(default) -
tagstringThe name of the xml tag generated for each iteration.
ValueDescription
iteration(default) -
waitintegerWait interval after each iteration, in milliseconds.
ValueDescription
0(default) -
splitbooleanIndicates whether the execution of the parent node is repeated for each iteration.
ValueDescription
0(default) -
Output
A iteration number='n'/ XML tag is generated for each iteration.
Side effects
When split=1 the execution of the immediate parent node is repeated for each iteration.
Samples
Executing system command
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<xdfl:_MODULE_COMPILE name="testmod" >
<xdfl:PASSIVE >
<xdfl:NULL >
<xdfl:OUTPUT >
<blah >
<xdfl:INPUT />
</blah>
</xdfl:OUTPUT>
</xdfl:NULL>
</xdfl:PASSIVE>
</xdfl:_MODULE_COMPILE>
<xdfl:MODULE_EXEC name="testmod" >
<xdfl:SEQUENCE min="1wait="2000step="2" />
</xdfl:MODULE_EXEC>
</XDFL>

1.2.14. SYSTEM : System calls

The SYSTEM node enables the execution of system commands inserted into an XML stream. The content of each TEXT or CDATA section is executed as a system command
Interface
Input
An XML stream
Output
The input stream, with system calls contained in TEXT or CDATA sections replaced by their return value.
Side effects
Executes the system commands contained in TEXT and CDATA sections
Samples
Executing system command
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<xdfl:OUTPUT >
<xdfl:SYSTEM >
<commands >
<!-- display system's version -->
<command >
ver
</command>
<!-- display date -->
<command >
date /T
</command>
</commands>
</xdfl:SYSTEM>
</xdfl:OUTPUT>
</XDFL>

1.2.15. VAL : Generation of variables

If a name/value pair is provided a variable is generated with the specified name and the specified value. If an XML input stream is provided.The SPLIT node generates variables from the input XML stream for each TEXT section, CDATA section and each attribute. The name of the generated variable is the XPATH path to the section or the attribute, where slashed are replaced by dots.
Interface
Input
An XML stream.
Parameters
NameTypeDescription
nameintegerThe name of the variable to generate, in case of a generation by name/value pair.
valueintegerThe value of the variable to generate, in case of a generation by name/value pair.
valuesbooleanIn case of a generation from the input stream, indicates that variables will be generated from the values (TEXT, CDATA and attributes) found in the inout stream.
ValueDescription
1(default) - The CDATA, TEXT and attributes generate variables values.
0The CDATA, TEXT and attributes do not generate variables values.
filterstringIn case of a generation from the input stream, Indicates a list of names to limit the values which are generated (names separated by comas).
countbooleanIn case of a generation from the input stream, indicates that variables will be generated by counting the occurences of each generated variable name in the input stream. Generated variables will be suffixed with an exclamation point.
ValueDescription
0(default) - The occurences of variables names are not counted.
1The occurences of variables names are counted and '!'-suffixed variables are generated.
listbooleanIn case of a generation from the input stream, if multiple occurences of the same variable are generated, indicates that the value of the generated variable is a list a found values.
ValueDescription
0(default) - The value of the variable is the value of the last occurence found.
1The value of the variable is a list of values found in the input stream for this name.
separatorstringIn case of a generation from the input stream, with list=1, indicates the string which will be used as list separator
ValueDescription
,(default) -
Output
The input XML stream.
Side effects
Variables are generated according to the input XML stream and arguments.
Samples
Assigning variables from name/values pairs
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- set 'myvar' to 'valeur1' -->
<xdfl:VAL name="myvar1value="valeur1" />
<!-- set 'myvar2' to the value of 'myvar1' -->
<xdfl:VAL name="myvar2value="@@[VAL:myvar1]@@" />
<!-- output variables values -->
<xdfl:OUTPUT >
  
myvar1 : 
<xdfl:GET val="myvar2" />
myvar2 : @@[VAL:myvar2]@@
	
</xdfl:OUTPUT>
</XDFL>
Assigning variables from an input stream
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- assigning variables from a stream -->
<xdfl:VAL list="1" >
<a >
<b >
valeur1
</b>
<c attr="valeur2" >
				valeur3
			
</c>
<b >
valeur4
</b>
</a>
</xdfl:VAL>
<!-- output variables values -->
<xdfl:OUTPUT >
  
a.b : @@[VAL:a.b]@@
a.c.@attr : @@[VAL:a.c.@attr]@@
a.c : @@[VAL:a.c]@@
	
</xdfl:OUTPUT>
</XDFL>

1.3. Access to file and folders.

1.3.1. FS_FIND : File and directories searching / listing.

The FS_FIND node list the directories and files matching a path and mask.
Interface
Parameters
NameTypeDescription
path*stringThe path to be searched.
recursestringRecursive search on subdirectories.
ValueDescription
0(default) - Recursive search is not performed.
1Recursive search is performed on directories and subdirectories.
flattenstringIn case of a recursive search, indicates whether to nest subdirectories or not.
ValueDescription
0(default) - Subdirectories are nested in parents.
1Subdirectories are returned at same depth as parents.
regexpstringIndicates a regular expression to filter returned items. Only files and directories whose name match the porvided regular expression are returned.
globstringIndicates a unix glob to filter returned items. Only files and directories whose name match the porvided unix glob are returned.
match_casebooleanIndicates whether filtering is case sensitive or not.
ValueDescription
0(default) - Filtering is not case sensitive.
1Filtering is case sensitive.
liststringIndicates what kind of items are to be listed. The argument is provided as a list of characters.
ValueDescription
f(default) - list files.
d(default) - list directories.
b(default) - list block devices.
c(default) - list character devices.
F(default) - list FIFOs.
s(default) - list sockets.
o(default) - list others.
formatstringIndicates formatting rules for the returned names and pathes. The argument is provided as a list of characters
ValueDescription
llowercase.
uuppercase.
/use forward slashes.
\use backward slashes.
string|integer|boolean
ValueDescription
Output
XML tree listing returned items.
Samples
(simple) UNIX find, XML flavor
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<xdfl:OUTPUT >
<xdfl:FS_FIND path="@@[VAL:ARG.path]@@recurse="1glob="@@[VAL:ARG.match]@@" />
</xdfl:OUTPUT>
</XDFL>

1.3.2. FS_GET : Reading from file.

The FS_GET node reads data from a file and outputs it to output stream.
Interface
Parameters
NameTypeDescription
target*stringPath of the source file.
streamdataintegerSize of each data packet sent to output, in bytes.
ValueDescription
32768
Output
Data read from file.
Samples
File copy
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!--Read the input file, write to output -->
<xdfl:FS_SET target="@@[VAL:ARG.dest]@@" >
<xdfl:FS_GET target="@@[VAL:ARG.org]@@" />
</xdfl:FS_SET>
<xdfl:OUTPUT >
File @@[VAL:ARG.org]@@ Copied to @@[VAL:ARG.dest]@@
</xdfl:OUTPUT>
</XDFL>

1.3.3. FS_SET : Writting to file

The FS_SET node writes input stream to specified file.
Interface
Input
An XML or non-XML stream.
Parameters
NameTypeDescription
target*stringThe path of the destination file.
headerstringString to be written at he beginning of the file.
actionstringIndicates an action to be performed on the file.
ValueDescription
flush(default) - The file is emptied before writting data.
appendData is append at the end of the file.If the file does not exists, it is created.
deleteThe destintion file is deleted.No data is written.
Output
The input stream.
Side effects
The input stream is written to destination file, or the file is deleted.
Samples
File copy
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!--Read the input file, write to output -->
<xdfl:FS_SET target="@@[VAL:ARG.dest]@@" >
<xdfl:FS_GET target="@@[VAL:ARG.org]@@" />
</xdfl:FS_SET>
<xdfl:OUTPUT >
File @@[VAL:ARG.org]@@ Copied to @@[VAL:ARG.dest]@@
</xdfl:OUTPUT>
</XDFL>

1.4. Definition of modules and classes, invocation of functions, creation of objects.

1.4.1. _CLASS_DECLARE : Declaration of a class

The _CLASS_DECLARE node creatés a new class. The input stream can be used as a parameter of the class definition.
Interface
Input
An XML or non-XML stream. The input stream can be used as a parameter of the class definition.
Parameters
NameTypeDescription
class*stringThe name of the class
extendsstringThe name of the class from which the new class inherits.
init_classstringClass initialization function. This is a function from an ancestor class which is called at class declaration. The input stream passed to this function is the input stream of the _CLASS_DECLARE node. The output stream of the _CLASS_DECLARE node is the output stream produces by this function.
Output
Depends on the class initialization function.
Side effects
The new class is created. Modules can be added to this class and objects can be created from this class.
Samples
Class declarion, modules and heritage
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- Class 1 -->
<xdfl:_CLASS_DECLARE class="class1" />
<xdfl:_MODULE_COMPILE class="class1name="moduleA" >
<xdfl:PASSIVE >
<xdfl:NULL >
<xdfl:MODULE_EXEC name="moduleB" >
<xdfl:INPUT />
</xdfl:MODULE_EXEC>
</xdfl:NULL>
</xdfl:PASSIVE>
</xdfl:_MODULE_COMPILE>
<xdfl:_MODULE_COMPILE class="class1name="moduleB" >
<xdfl:PASSIVE >
<xdfl:NULL >
<class1 >
<xdfl:INPUT />
</class1>
</xdfl:NULL>
</xdfl:PASSIVE>
</xdfl:_MODULE_COMPILE>
<!-- Class 2 -->
<xdfl:_CLASS_DECLARE class="class2extends="class1" />
<xdfl:_MODULE_COMPILE class="class2name="moduleB" >
<xdfl:PASSIVE >
<xdfl:NULL >
<class2 >
<xdfl:INPUT />
</class2>
</xdfl:NULL>
</xdfl:PASSIVE>
</xdfl:_MODULE_COMPILE>
<xdfl:_MODULE_COMPILE class="class2name="moduleC" >
<xdfl:PASSIVE >
<xdfl:NULL >
<xdfl:MODULE_EXEC ancestor="class1name="moduleB" >
<xdfl:INPUT />
</xdfl:MODULE_EXEC>
</xdfl:NULL>
</xdfl:PASSIVE>
</xdfl:_MODULE_COMPILE>
<!-- Execution -->
<xdfl:OUTPUT >
<xdfl:MODULE_EXEC class="class1name="moduleA" >
<class1_module_a />
</xdfl:MODULE_EXEC>
<xdfl:MODULE_EXEC class="class2name="moduleA" >
<class2_module_a />
</xdfl:MODULE_EXEC>
<xdfl:MODULE_EXEC class="class2name="moduleC" >
<class2_module_c />
</xdfl:MODULE_EXEC>
</xdfl:OUTPUT>
</XDFL>

1.4.2. _MODULE_COMPILE : Compiles a new module on an existing class.

the _MODULE_COMPILE node compiles a new module (ie method or function) and adds it to the specified class.
Interface
Input
The XDFL script to be compiled as a module. The input is usually given as a PASSIVE stream, so it is not interpreted before being compiled.
Parameters
NameTypeDescription
classstringThe class on which the module is added
ValueDescription
GLOBAL(default) - Compile the module as a global method, ie as a method of the GLOBAL class.
name*stringThe name of the module
tagstringProvides a tag name to use the module as an XDFL node.
Side effects
The new module is compiled and added to the class. The module can then be called.
Comments
Defining the constructor of a class
If a module is compiled with the name 'init' on a class, it is the constructor of that class. This module is be called after every object creation.
Samples
Compiling and executing modules
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- Compilation du module -->
<xdfl:_MODULE_COMPILE name="gen_enveloppe" >
<xdfl:PASSIVE >
<xdfl:NULL >
<xdfl:IF val1="@@[VAL:ARG.type]@@val2="XML" >
<XML >
<xdfl:INPUT />
</XML>
</xdfl:IF>
<xdfl:IF val1="@@[VAL:ARG.type]@@val2="DATA" >
<DATA >
<xdfl:INPUT />
</DATA>
</xdfl:IF>
</xdfl:NULL>
</xdfl:PASSIVE>
</xdfl:_MODULE_COMPILE>
<!-- exécution -->
<xdfl:OUTPUT >
<xdfl:MODULE_EXEC name="gen_enveloppetype="DATA" >
<xdfl:MODULE_EXEC name="gen_enveloppetype="XML" >
<some_xml >
<data />
</some_xml>
</xdfl:MODULE_EXEC>
</xdfl:MODULE_EXEC>
</xdfl:OUTPUT>
</XDFL>

1.4.3. CLASS_CREATEOBJECT : Creation of an object from a class.

The CLASS_CREATEOBJECT create a new object from the indicated class. If the class provies a constructor, it is called after object creation.
Interface
Input
An XML or Non-XML stream. The input stream is passed as argument to the constructor.
Parameters
NameTypeDescription
class*stringThe name of the instanciated class.
object*stringThe name of the object to create
Output
]The output stream is the stream returned by the constructor.
Side effects
The object is created and stored in current context. The object conists in a special context named 'OBJECT'.
Samples
Using objects
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- Class 1 -->
<xdfl:_CLASS_DECLARE class="class1" />
<xdfl:_MODULE_COMPILE class="class1name="init" >
<xdfl:PASSIVE >
<xdfl:NULL >
<xdfl:BUF_SET context="OBJECTcreate="1name="object_buffer" >
<xdfl:INPUT />
</xdfl:BUF_SET>
<xdfl:VAL context="OBJECTname="propvalue="(NULL)" />
</xdfl:NULL>
</xdfl:PASSIVE>
</xdfl:_MODULE_COMPILE>
<xdfl:_MODULE_COMPILE class="class1name="set_prop" >
<xdfl:PASSIVE >
<xdfl:NULL >
<xdfl:VAL context="OBJECTname="propvalue="@@[VAL:ARG.val]@@" />
</xdfl:NULL>
</xdfl:PASSIVE>
</xdfl:_MODULE_COMPILE>
<xdfl:_MODULE_COMPILE class="class1name="get_data" >
<xdfl:PASSIVE >
<xdfl:NULL >
<xdfl:BUF_GET name="object_buffer" />
</xdfl:NULL>
</xdfl:PASSIVE>
</xdfl:_MODULE_COMPILE>
<xdfl:_MODULE_COMPILE class="class1name="get_xml" >
<xdfl:PASSIVE >
<xdfl:NULL >
<object_class1 prop="@@[VAL:prop]@@" >
<xdfl:MODULE_EXEC name="get_data" />
</object_class1>
</xdfl:NULL>
</xdfl:PASSIVE>
</xdfl:_MODULE_COMPILE>
<!-- object1 -->
<xdfl:CLASS_CREATEOBJECT class="class1object="object1" >
<object1 >
<data />
</object1>
</xdfl:CLASS_CREATEOBJECT>
<xdfl:MODULE_EXEC object="object1name="set_propval="1" />
<!-- Execution -->
<xdfl:OUTPUT >
<xdfl:MODULE_EXEC object="object1name="get_xml" />
		
	object1/prop:@@[VAL:object1/prop]@@
	
</xdfl:OUTPUT>
</XDFL>

1.4.4. MODULE_EXEC : Invocation of a module.

The MODULE_EXEC node calls a module on as a static mathod of a class or as a method of an existing object.
Interface
Input
An XML or Non-XML stream. The input stream is passed as argument to the module.
Parameters
NameTypeDescription
name*stringThe name of the module to invoke.
class*stringThe name of a class to invoke the module as a static method.
ancestorstringThe name of an ancestor class of the current class. This parameter forces to search the module in the indicated ancestor members.
object*stringThe name of an object to invoke the module as a method of this object. This parameter can not be provided with the 'class' parameter.
isolatebooleanIndicates whether a context is allocated for the execution of the module.
ValueDescription
1(default) - A 'MODULE' context is allocated for the execution of the module. This context is a child of the current context and is destroyed at then end of the execution of the module.
0The current context is used for the execution of the module.
Output
]The output stream is the stream returned by the module.
Side effects
Depends on the module.
Samples
Compiling and executing modules
<?xml version="1.0" encoding="ISO-8859-1"?>

<XDFL xmlns:xdfl="xdfl">
<!-- Compilation of the module -->
<xdfl:_MODULE_COMPILE name="gen_enveloppe" >
<xdfl:PASSIVE >
<xdfl:NULL >
<xdfl:IF val1="@@[VAL:ARG.type]@@val2="XML" >
<XML >
<xdfl:INPUT />
</XML>
</xdfl:IF>
<xdfl:IF val1="@@[VAL:ARG.type]@@val2="DATA" >
<DATA >
<xdfl:INPUT />
</DATA>
</xdfl:IF>
</xdfl:NULL>
</xdfl:PASSIVE>
</xdfl:_MODULE_COMPILE>
<!-- execution -->
<xdfl:OUTPUT >
<xdfl:MODULE_EXEC name="gen_enveloppetype="DATA" >
<xdfl:MODULE_EXEC name="gen_enveloppetype="XML" >
<some_xml >
<data />
</some_xml>
</xdfl:MODULE_EXEC>
</xdfl:MODULE_EXEC>
</xdfl:OUTPUT>
</XDFL>

1.4.5. SCRIPT_EXEC : Execution of a XDFL script.

The SCRIPT_EXEC compiles and executes a XDFL script provided as input stream, as a buffer or as a file.
Interface
Input
Nothing or a XDFL script.
Parameters
NameTypeDescription
filestringPath of the file contining the XDFL script to execute.
namestringPath of the buffer containing the XDFL script to execute.
isolatebooleanIndicates whether a context is allocated for the execution of the script.
ValueDescription
1(default) - A 'SUBSCRIPT' context is allocated for the execution of the script. This context is a child of the current context and is destroyed at then end of the execution of the script.
0The current context is used for the execution of the script.
Output
The stream returned bu the execution of the script.
Side effects
Depends on the script.

II. javascript
Embedded javascript engine pluggable Module.

2.1. Compilation and execution of JS scripts in a XDFL script.

2.1.1. JS_COMPILE : Compilation of a Javascript script.

Compilation of a Javascript script.
Interface
Input
A TEXT or CDATA section containing valid Javascript code.
Side effects
The script is compiled in the current javascript runtime context. If this context does not exist, it is created. The javascript runtime context is stored in current XDFL context.
Comments
Interactions beetween Javascript and XDFL
In order to make it possible for javascript to interact with the XDFLengine, a javascript object called XDFL, is accessible in the javascript code. Its functionalities are :
  • XDFL.input() : returns input document as a string.

  • XDFL.output(text) : writes string 'text' on the output of the calling JS_EXEC node.

  • XDFL.arg(argname) : returns the value of the argname parameter given in the JS_EXEC calling tag.

  • XDFL.getValue(valname) : returns the value of the XDFL variable called valname.

  • XDFL.setValue(valname, value) : assign value to the XDFL variable valname.

  • XDFL.log(text) : writes text in the log file.

  • Working whith jsMicroDom.
    At execution time, it is possible to choose to work with a DOM input rather than with a string input (parse_dom=1 parameter of the JS_EXEC node).
    In this case, the input document is parsed and made accessible using a subset of the DOM (jsMicroDom) and XPATH (jsMicroXpath).

    If parse_dom parameter is set to 1, more methods of the XDFL object are available :
  • XDFL.XMLinput() : returns input document as a jsMicroDOM document.

  • XDFL.outputXML(node) : writes the XML stream corresponding to the jsMicroDOM node node and its child nodes on the output of the calling JS_EXEC node.

  • XDFL.select(path) : executes the jsMicroXpath path request on the input and returns the value of the node.

  • XDFL.selectSingleNode(node, path) : returns the first node corresponding to the path jsMicroXpath request starting at the node node.

  • XDFL.selectNodes(node, path) : returns a collection of nodes corresponding to the path jsMicroXpath request starting at the node node.


  • The jsMicroDOM model represents a XML document as an XMLDOMElement objects tree. A XMLDOMElement node may have a XMLDOMElement parent node, a collection of XMLDOMElement child nodes, a collection of named attributes, and text content. XMLDOMElement classes has the following attributes and functions:
  • XMLDOMElement.nodeName : name of the node.

  • XMLDOMElement.parentNode : XMLDOMElement parent node.

  • XMLDOMElement.attributes : collection of named attributes.

  • XMLDOMElement.childNodes : collection of child XMLDOMElement nodes.

  • XMLDOMElement.nodeValue : content of the text node.

  • XMLDOMElement.appendChild( node) : append the child node node and returns this node.

  • XMLDOMElement.removeChild( node) : remove the child node node and returns this node.

  • XMLDOMElement.replaceChild( newnode ,node) : replace node by newnode and return this node.

  • XMLDOMElement.getAttribute( name) : return name attribute.

  • XMLDOMElement.setAttribute( name, value) : set value of attribute name to value.

  • XMLDOMElement.removeAttribute( name) : remove attribute name.

  • Samples
    Compiling and executing a JS script.
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <!-- compilation of a JS script -->
    <xdfl:JS_COMPILE >
    		
    function makeNodes()
    {		
    	OB = String.fromCharCode("60")
    	CB = String.fromCharCode("62")
    	XDFL.output( OB+"nodes" + CB+ "\n\t")
    	for(i=0; XDFL.arg("num")!=i; i++)
    	{
    		XDFL.output(OB+"node"+i+"/"+CB);
    	}
    	XDFL.output( "\n"+OB+"/nodes" + CB)
    }
    
    function getStreamLength()
    {
    	XDFL.setValue("length", XDFL.input().length)
    	XDFL.output(XDFL.input())
    }
    		
    	
    </xdfl:JS_COMPILE>
    <!-- Execution of the script... -->
    <xdfl:OUTPUT >
    <XML >
    <xdfl:JS_EXEC call="getStreamLength()" >
    <xdfl:JS_EXEC call="makeNodes()num="10" />
    </xdfl:JS_EXEC>
    <length >
    @@[VAL:length]@@
    </length>
    </XML>
    </xdfl:OUTPUT>
    </XDFL>

    2.1.2. JS_EXEC : JS script execution node.

    The JS_EXEC nodes calls a previously compiled javascript function.
    Interface
    Input
    An XML or non-XML stream. The input stream is available to the the called function. If jsMicroDOM is used, the insput stream must e a XML document.
    Parameters
    NameTypeDescription
    call*stringThe name of the function to call
    parse_dombooleanIndicates whether to use jsMicroDOM or not.
    ValueDescription
    0(default) - The input stream is provided 'as-is' to the JS script. No DOM parsing is done and jsMicroDOM is not used.
    1The input stream is parsed as a DOM document which is provided to the JS script. jsMicroDOM is used.
    Output
    Depends on the executed javascript.
    Side effects
    Depends on the executed javascript.
    Samples
    Using jsMicroDOM
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <!-- compilation d'un script JS -->
    <xdfl:JS_COMPILE >
    		
    function sumOrders()
    {
    try{
    	xmlOrderEntries = XDFL.selectNodes( XDFL.XMLinput(),"mcrm_client/mcrm_order/mcrm_order_entry")
    	
    	intNumOrders = xmlOrderEntries.length
    	intTotalPrice = 0
    	
    	for(i=0; i != intNumOrders-1; i++)
    	{
    		xmlOrderEntry = xmlOrderEntries[i]
    		XDFL.log(xmlOrderEntry.getAttribute("fk_order"))
    		intPrice = XDFL.selectSingleNode(xmlOrderEntry, "mcrm_product/price").nodeValue
    
    		intQuant = XDFL.selectSingleNode(xmlOrderEntry, "quantity").nodeValue
    		intTotalPrice += intPrice*intQuant
    	}
    
    	intAvgPrice = intTotalPrice / intNumOrders
    	
    	xmlOutputTotal=new XMLDOMElement("XML")
    	xmlOutputTotal.appendChild(new XMLDOMElement("total")).nodeValue = intTotalPrice
    	xmlOutputTotal.appendChild(new XMLDOMElement("number")).nodeValue = intNumOrders
    	xmlOutputTotal.appendChild(new XMLDOMElement("average")).nodeValue = intAvgPrice
    	
    	XDFL.outputXML( xmlOutputTotal)
    	} catch(e){XDFL.log(e)}
    }
    			
    		
    </xdfl:JS_COMPILE>
    <xdfl:OUTPUT >
    <!-- Execution ... -->
    <xdfl:JS_EXEC call="sumOrders()parse_dom="1" >
    <xdfl:FS_GET target="../sample_data/sample_data.xml" />
    </xdfl:JS_EXEC>
    </xdfl:OUTPUT>
    </XDFL>

    III. xsl
    XSLT transformations and XPATH selection pluggable modules

    3.1. XSL transformations.

    3.1.1. XSL_COMPILE : XSL style sheet compilation

    The XSL_COMPILE node compiles and caches the XL sheet provided as input XML document.
    Interface
    Input
    The XSL sheet to compile.
    Parameters
    NameTypeDescription
    name*stringThe name of the compiled sheet.
    Side effects
    The compiled is cached and can be used for transformations with the XSL_TRANSFORM node, using the name given for compilation.
    Samples
    XSLT transformation tool
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <!-- Read and compile the xsl sheet from a file -->
    <xdfl:XSL_COMPILE name="xsl_sheet" >
    <xdfl:FS_GET target="@@[VAL:ARG.xsl]@@" />
    </xdfl:XSL_COMPILE>
    <!-- Transform input using compiled sheet, output result -->
    <xdfl:OUTPUT >
    <xdfl:XSL_TRANSFORM name="xsl_sheet" >
    <xdfl:INPUT />
    </xdfl:XSL_TRANSFORM>
    </xdfl:OUTPUT>
    </XDFL>

    3.1.2. XSL_TRANSFORM : XSLT transformation.

    The XSL_TRANFORM node performs a transformation on the input document using a compiles stule sheet.
    Interface
    Input
    The XML document to transform.
    Parameters
    NameTypeDescription
    name*stringThe name of the compiled sheet.
    append-headerbooleanIndicates whether append a XML header to the input document.
    ValueDescription
    1(default) - A XML header is added at the top of the input document.
    0No XML header is added at the top of the input document.
    Output
    The transformed XML document.
    Samples
    XSLT transformation tool
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <!-- Read and compile the xsl sheet from a file -->
    <xdfl:XSL_COMPILE name="xsl_sheet" >
    <xdfl:FS_GET target="@@[VAL:ARG.xsl]@@" />
    </xdfl:XSL_COMPILE>
    <!-- Transform input using compiled sheet, output result -->
    <xdfl:OUTPUT >
    <xdfl:XSL_TRANSFORM name="xsl_sheet" >
    <xdfl:INPUT />
    </xdfl:XSL_TRANSFORM>
    </xdfl:OUTPUT>
    </XDFL>

    3.2. XPATH selections.

    3.2.1. XPATH_SELECT : XPATH node selection in a XML document

    the XPTH node allows to perform selection of nodes from the input XML document.
    Interface
    Input
    The XML document to select the nodes from.
    Parameters
    NameTypeDescription
    path*stringthe xpath request to use.
    append-headerbooleanIndicates whether append a XML header to the input document.
    ValueDescription
    1(default) - A XML header is added at the top of the input document.
    0No XML header is added at the top of the input document.
    Output
    The selected nodes.
    Samples
    XPATH selection tool
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <xdfl:OUTPUT >
    <xdfl:XPATH_SELECT path="@@[VAL:ARG.path]@@" >
    <xdfl:INPUT />
    </xdfl:XPATH_SELECT>
    </xdfl:OUTPUT>
    </XDFL>

    IV. db
    Relationnal databases access pluggable module.

    4.1. Access to relationnal database using recordset mode.

    4.1.1. SQL : SQL query execution.

    The SQL node enables the execution of SQL queries parametered by XML input stream and returns the result in the form of a tabular XML stream. The input stream must have a tabular structure.
    Interface
    Input
    Nothing or a tabular XML stream.
    Parameters
    NameTypeDescription
    connection*stringThe connection string to the database.
    statement*stringThe SQL statement to execute.
    enclose_recordstringThe name of the tag used to enclose each outputed records.
    ValueDescription
    (default) - No tag is used to enclose outputed records.
    flushrecordsintegerNumber to records to output at once.
    ValueDescription
    1(default) -
    streamrecordsintegerNumber to records send to to stream at once.
    ValueDescription
    1(default) -
    commitrecordsintegerNumber to records to commit at once.
    ValueDescription
    1(default) -
    buffersizeintegerNumber of records bufferized before being sent to DB
    ValueDescription
    (default) -
    dberror_fatalbooleanIndicates whether a DB error stops the execution of the node or not.
    ValueDescription
    1(default) - The execution of the node stops on the occurence of a DB error.
    0The execution of the node does not stop on the occurence of a DB error.
    transmit_databooleanForces the node to behave as a transparent node.
    ValueDescription
    0The output stream is generated by the SQL statement.
    0The input stream is transmitted indentical to the output.
    lowercasebooleanLowercase outputed XML tags.
    ValueDescription
    0(default) - The outputed XML tags are UPPERCASE.
    1The outputed XML tags are lowercase.
    filter_columnsstringFilter clause for the columns in the input data set. If this parameter is empty or absent, the processor attempts to link all values found in the query.If this parameter has the value (auto), data in the input data set are linked to the query by comparing the name in the XML stream to the name of the linked variable. If this parameter is a list of names, only data from the data set mentioned in the list is linked.
    ValueDescription
    (default) - All columns are considered.
    (auto)Auto filter column by comparing XML tags and columns names.
    Output
    An XML tabular stream representing the records generated by the SQL query.
    Side effects
    The side effects from the execution of an active SQL node are the side effects of the given SQL query.
    Comments
    Linked variables
    Input data is necessary only when using linked variables :
    If the query supplied contains linked variables, these are evaluated with the help of the input stream.
    Each "line" of the input set of data is used to evaluate an instance of the query, the values being assigned sequentially to linked variables.
    The syntax used to create linked variables is: variable_name.
    Types of data valid for linked variables are:
  • int (signed integer),

  • unsigned (unsigned integer),

  • short (short integer),

  • long (long integer),

  • float (4-byte float),

  • double (8-byte float),

  • timestamp (MS SQL Server DATETIME, DB2 TIMESTAMP, Oracle DATE, Oracle 9i TIMESTAMP),

  • char[taille] (NULL-terminated character string) ,

  • db2date (DB2 DATE),

  • db2time (DB2 TIME),

  • varchar_long (Oracle LONG, ODBC SQL_LONGVARCHAR, DB2 CLOB),

  • raw_long (Oracle RAW / LONG RAW, ODBC : SQL_LONGBINARY / SQL_VARBINARY, DB2 BLOB),

  • clob (Oracle 8/9 CLOB : NCLOB),

  • blob (Oracle 8/9 BLOB),

  • Executing SELECT statements
    When executing a SQL SELECT statement, the SQL node behaves as a filter node, using input data to valuate and multiply the SQL request, and generates a tabular output stream which represents the selected records.
    Executing INSERT, UPDATE or DELETE statements
    When executing a INSERT, UPDATE or DELETE statement, the SQL nodes behaves as a consumer node, using input data to valuate and multiply the SQL request, and do not generates any output.
    Samples
    SQL extract
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <xdfl:OUTPUT >
    <DATA >
    <xdfl:SQL connection="@@[VAL:ARG.dsn]@@statement="@@[VAL:ARG.sql]@@streamrecords="100enclose_record="ROW" />
    </DATA>
    </xdfl:OUTPUT>
    </XDFL>
    SQL insert
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <xdfl:OUTPUT >
    <DATA >
    <xdfl:SQL connection="@@[VAL:ARG.dsn]@@statement="@@[VAL:ARG.sql]@@filter_columns="(auto)" >
    <xdfl:INPUT />
    </xdfl:SQL>
    </DATA>
    </xdfl:OUTPUT>
    </XDFL>

    4.2. Preparing and compiling XML-Relationnal mapping definitions.

    4.2.1. DB_AUTODESC : DB objects defition automatic completion.

    The DB_AUTODESC node enables the enrichment of an object definition supplied in the input stream by adding to it, for each node, all fields existing in the database but not mentioned in the definition. This enables the provision, as input, of a "minimal" object definiton which contains only the structural fields and nodes (i.e. the primary keys, both internal and external). The added fields are textual sub-nodes, whose names are the names of database columns (in lower case). The DBfield, map, date_format (if date field) properties are assigned. For all fields (even those already present in the definition), the dbspec property is assigned. It contains additional information about the field: OTL code, DBMS code, size, scale, degree of precision, NULL authorised.
    Interface
    Input
    The DB object definition to complete.
    Parameters
    NameTypeDescription
    connection*stringThe connection string to the database.
    expand_fieldsbooleanIndicates whether columns of the table which are not present in the definition should be added or not.
    ValueDescription
    1(default) - Table columns which are not present in the definition are inserted and qualified.
    0No additional fields are added, only those present in the definition are qualified.
    Output
    The completed DB definition
    Side effects
    May cause a DB connection to be pooled.
    Comments
    Locked nodes
    For the nodes whick are locked in the definition (attribute lock='1'), fields are never expanded. Only fields present in those nodes are qualified.
    Samples
    Definition autocompletion and compilation
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <xdfl:_DBDEF_COMPILE name="dbobject" >
    <xdfl:DB_AUTODESC connection="@@[VAL:ARG.dsn]@@expand_field="1" >
    <node name="clientDBtable="MCRM_CLIENTpkey="@idlock="0" >
    <field name="@idDBfield="id_clientivalue="@@[SQL:SELECT MCRM_SEQ_CLIENT.nextVal from DUAL]@@" />
    <node name="client_orderDBtable="MCRM_ORDERpkey="@idinkey="@id_clientoutkey="@id" >
    <field name="@idDBfield="id_orderivalue="@@[SQL:SELECT MCRM_SEQ_ORDER.nextVal from DUAL]@@" />
    <field name="@id_clientDBfield="fk_clientvalue="@@[XPATH:../@id]@@" />
    <node name="order_entryDBtable="MCRM_ORDER_ENTRYpkey="@id_order,@id_productinkey="@id_orderoutkey="@id" >
    <field name="@id_orderDBfield="fk_ordervalue="@@[XPATH:../@id]@@" />
    <field name="@id_productDBfield="fk_productvalue="@@[XPATH:mcrm_product/@id]@@" />
    <node name="productDBtable="MCRM_PRODUCTpkey="@idinkey="@idoutkey="@id_productlock="1" >
    <field name="@idDBfield="id_product" />
    <field name="descriptionDBfield="descriptionDBmap="string" />
    </node>
    </node>
    </node>
    </node>
    </xdfl:DB_AUTODESC>
    </xdfl:_DBDEF_COMPILE>
    </XDFL>

    4.2.2. _DBDEF_COMPILE : Compilation of DB objects definitions

    The _DBDEF_COMPILE node compiles input DB object definition and associates a name to the compiled definition for further use.
    Interface
    Input
    The DB object definition to compile.
    Parameters
    NameTypeDescription
    name*stringThe name of the compiled definition
    Output
    The input XML stream.
    Side effects
    Stores the compiled definition in cache.
    Samples
    Definition autocompletion and compilation
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <xdfl:_DBDEF_COMPILE name="dbobject" >
    <xdfl:DB_AUTODESC connection="@@[VAL:ARG.dsn]@@expand_field="1" >
    <node name="clientDBtable="MCRM_CLIENTpkey="@idlock="0" >
    <field name="@idDBfield="id_clientivalue="@@[SQL:SELECT MCRM_SEQ_CLIENT.nextVal from DUAL]@@" />
    <node name="client_orderDBtable="MCRM_ORDERpkey="@idinkey="@id_clientoutkey="@id" >
    <field name="@idDBfield="id_orderivalue="@@[SQL:SELECT MCRM_SEQ_ORDER.nextVal from DUAL]@@" />
    <field name="@id_clientDBfield="fk_clientvalue="@@[XPATH:../@id]@@" />
    <node name="order_entryDBtable="MCRM_ORDER_ENTRYpkey="@id_order,@id_productinkey="@id_orderoutkey="@id" >
    <field name="@id_orderDBfield="fk_ordervalue="@@[XPATH:../@id]@@" />
    <field name="@id_productDBfield="fk_productvalue="@@[XPATH:mcrm_product/@id]@@" />
    <node name="productDBtable="MCRM_PRODUCTpkey="@idinkey="@idoutkey="@id_productlock="1" >
    <field name="@idDBfield="id_product" />
    <field name="descriptionDBfield="descriptionDBmap="string" />
    </node>
    </node>
    </node>
    </node>
    </xdfl:DB_AUTODESC>
    </xdfl:_DBDEF_COMPILE>
    </XDFL>

    4.3. Using XML-Relationnal mapping definitions to extract or insert DB objects to database.

    4.3.1. DB_GET : Extraction of DB objects from database.

    The DB_GET node permits the extraction of XML objects from the database. The composition of the objects to extract is given by the compiled object definition designated in the target parameter. The form of the object to extract is determined from the XML query supplied in the input stream. This query recreates the node structure of the object to extract, replacing the fields with filter or sort clauses. Filter clauses are only effective on the sub-tree on which they are defined (restrictions do not extend to the object root).
    Interface
    Input
    A DB object extraction query.
    Parameters
    NameTypeDescription
    connection*stringThe connection string to the database.
    target*stringThe name of the compiled DB object definition to use.
    flatbooleanExtracts only the root node of the objects
    ValueDescription
    0(default) - Full objects are extracted.
    1Onl root nodes of objects are extracted.
    maxitemsintegerThe maximum number of objects to extract. Using this parameters sets flat parameter to '1'.
    ValueDescription
    0(default) - No limit to the number of extracted objects.
    streamobjectsintegerNumber to objects to send to stream at once.
    ValueDescription
    1(default) -
    buffersizeintegerNumber of SQL requests bufferized before being sent to DB
    ValueDescription
    (default) -
    Output
    An XML stream containing extracted objects.
    Side effects
    May cause a DB connection to be pooled.
    Comments
    DB object extraction query
    An object selection query recreates the structure of the nodes in the object to select and contains filter or sort clauses at each node level. The clauses contained in a node act upon the selection of nodes corresponding to the object (and its descendants). Restrictions do not extend to the parents (one cannot select a parent whose child meets a certain condition. One can however select those of a parent's children which meet a certain condition).

  • Filter clause: filter

  • A query may include an arbitrary number of filter clauses by node (clauses are cumulative). field: name of the field on which to perform the sort op (default='eq'): Filter operater. Available operaters are: eq (equal), neq (not equal), gt (greater than), gte (greater or equal), lt (less than), lte (less or equal) For alphanumeric fields: like, search (case-insensitive search with wildcard at end), find (case-insensitive search with wildcards at both beginning and end)
  • Sort clause: order

  • A query may include an arbitrary number of sort clauses by node. field: name of the field on which to perform the sort. op: sort operater: ASC for ascending sort, DESC for descending sort.
    Samples
    Definition autocompletion, compilation; Objects extraction
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <xdfl:_DBDEF_COMPILE name="dbobject" >
    <xdfl:DB_AUTODESC connection="@@[VAL:ARG.dsn]@@expand_field="1" >
    <xdfl:FS_GET target="@@[VAL:ARG.def]@@" />
    </xdfl:DB_AUTODESC>
    </xdfl:_DBDEF_COMPILE>
    <xdfl:OUTPUT >
    <xdfl:DB_GET connection="@@[VAL:ARG.dsn]@@target="dbobjectenclose="DATA" >
    <request >
    <filter field="@id" >
    @@[VAL:ARG.id]@@
    </filter>
    </request>
    </xdfl:DB_GET>
    </xdfl:OUTPUT>
    </XDFL>

    4.3.2. DB_SET : Insertion of DB objects in database.

    The DB_SET node permits XML objects supplied in the input stream to be submitted to the database to create, update or delete. The mapping of the objects submitted is determined using the object definition designated by the target parameter. The action to perform is given by the action parameter supplied in the query. It is also possible to specify an action at node level. The action taken into consideration is determined according to the action of the parent node and the action requested at node level. For every node, the SQL orders generated are sent to the database in such a way as to respect integrity constraints (traveling down and right from the sub-tree of the node in case of an insert or update, and down in the opposite direction in case of a delete).
    Interface
    Input
    An XML streaml containing objects to insert into database.
    Parameters
    NameTypeDescription
    connection*stringThe connection string to the database.
    target*stringThe name of the compiled DB object definition to use.
    actionstringThe action to perform on objects.
    ValueDescription
    insertObjects are append in database.
    update(default) - Objects are updated in database.
    deleteObjects are delete from database.
    noneNo action is performed on objects.
    commitobjectsintegerNumber to objects commit at once in database.
    ValueDescription
    1(default) -
    streamobjectsintegerNumber to objects to send to stream at once.
    ValueDescription
    1(default) -
    buffersizeintegerNumber of SQL requests bufferized before being sent to DB
    ValueDescription
    (default) -
    dberror_fatalbooleanIndicates whether a DB error stops the execution of the node or not.
    ValueDescription
    1(default) - The execution of the node stops on the occurence of a DB error.
    0The execution of the node does not stop on the occurence of a DB error.
    output_dberrorstringName of buffer to output DB generated errors in.
    ValueDescription
    (none)(default) - The DB generated errors are lost.
    (parent)The DB generated errors are sent to parent node in the output stream.
    [buffer name]The DB generated errors are sent to the indicated buffer.
    output_rejectstringName of buffer to output objects whch caused an error in.
    ValueDescription
    (none)The rejected objects are lost.
    (parent)(default) - The rejected objects are sent to parent node in the output stream.
    [buffer name]The rejected objects are sent to the indicated buffer.
    output_reportstringName of buffer to output actions report in.
    ValueDescription
    (none)(default) - The actions report errors is not generated.
    (parent)The actions report is sent to parent node in the output stream.
    [buffer name]The actions report is sent to the indicated buffer.
    countbooleanIndicates whether to count actions for each node of the objects in the actions report.
    ValueDescription
    0(default) - Actions for each node of the objects are not counted.
    1Actions for each node of the objects are counted.
    Output
    An XML stream containing inserted objects. Objects content may have been modified during insertion.
    Side effects
    Side effects are those concerned with the storing of objects in the database: data insertion, and possibly execution of triggers, stored procedures.
    Comments
    Controlling commits and stream generation
    The packobjects and commitpacks parameters offer control over the way in which orders are sent to the database, specifying the size of the object packet (number of objects for which queries have been accumulated prior to being sent to the database) and the commit size (number of packets before commit) respectively. This last parameter affects the composant's consumption of memory as all objects are kept in memory from the time they are processed to the time they are committed.
    Using errors and report stream
    It is possible to specify whether errors raised by the database halt processing or not (db_error_fatal parameter). If database errors are tolerated, error objects are redirected to the named buffer specified by the output_reject parameter, while error labels in XML format are redirected to the buffer designated by output_error. The output_report parameter enables the designation of a buffer in which is generated an end-of-process report. This report indicates whether an error has taken place, and, if the parameter count is at 1, includes an account of every action undertaken by the node.
    Samples
    Definition autocompletion and compilation ; Objects insertion
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <xdfl:_DBDEF_COMPILE name="dbobject" >
    <xdfl:DB_AUTODESC connection="@@[VAL:ARG.dsn]@@expand_field="1" >
    <xdfl:FS_GET target="@@[VAL:ARG.def]@@" />
    </xdfl:DB_AUTODESC>
    </xdfl:_DBDEF_COMPILE>
    <xdfl:OUTPUT >
    <xdfl:DB_SET connection="@@[VAL:ARG.dsn]@@target="dbobjectaction="@@[VAL:ARG.action]@@" >
    <xdfl:INPUT />
    </xdfl:DB_SET>
    </xdfl:OUTPUT>
    </XDFL>

    4.4. DB definition parsed expressions

    Additional parsed expressions available in the DB objects definitions.

    4.4.1. @@[SQL:query]@@ : insertion of the result of a SQL query

    the expression is an SQL query returning a result.
    Interface
    Parameters
    NameTypeDescription
    querystringSQL query to execute

    4.4.2. @@[XPATH:path]@@ : insertion of the result of a XPATH query in the object tree.

    the expression is an XPATH query of which the reference node is the current node in the input tree. This type of query enables the circulation of values in the input tree.
    Interface
    Parameters
    NameTypeDescription
    pathstringXPATH query

    V. smtp
    SMTP mailer pluggable module.

    5.1. Mail sending using SMTP.

    5.1.1. MAIL_SEND : Mail send.

    The MAIL_SEND node interprets input XML document as an e-mail and sends the message.
    Interface
    Input
    An XML document describing the message.
    Parameters
    NameTypeDescription
    serverstringThe address of the SMTP server used.
    ValueDescription
    127.0.0.1(default) - Use localhost as SMTP server.
    portintegerThe SMTP port of the server.
    ValueDescription
    25(default) - Default SMTP port.
    usernamestringThe user name used to anthenticate on the server.
    passwordstringThe password used to authenticate on the server.
    mxlookupstringIndicates whether to query MX record.
    ValueDescription
    0(default) - Do not query MX record.
    1Query MX record.
    Output
    The input stream.
    Side effects
    The mail are sent.
    Comments
    Mail as XML document
    See sample below for the format of the input XML document describing the mail to send.
    Samples
    Sending a mail with attachments.
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <xdfl:MAIL_SEND server="localhost" >
    <MAILS >
    <mail >
    <from >
    		sender@domain.com
    				
    </from>
    <to >
    		recipient@another-domain.org
    				
    </to>
    <to >
    		another-recipient@another-domain.biz
    				
    </to>
    <cc >
    		carbon-copy@another-domain.net
    				
    </cc>
    <bcc >
    		blind-carbon-copy@another-domain.net
    				
    </bcc>
    <subject >
    	The subject of the mail
    				
    </subject>
    <body >
    		A plain text message body
    				
    </body>
    <attach >
    	path/to/attached/file
    				
    </attach>
    <attach >
    	path/to/other/attached/file
    				
    </attach>
    </mail>
    <mail >
    <from >
    		sender@domain.com
    				
    </from>
    <to >
    		recipient@another-domain.org
    				
    </to>
    <cc >
    		carbon-copy@another-domain.net
    				
    </cc>
    <bcc >
    		blind-carbon-copy@another-domain.net
    				
    </bcc>
    <subject >
    	The subject of the second mail
    				
    </subject>
    <body >
    		A plain text message body for the second mail
    				
    </body>
    <attach >
    	path/to/attached/file
    				
    </attach>
    </mail>
    </MAILS>
    </xdfl:MAIL_SEND>
    </XDFL>

    VI. zip
    Zipped files module streamer

    6.1. Reading and wrtting to compressed files.

    6.1.1. GZ_GET : Uncompressing from file.

    The GZ_GET node reads data from a compressed file and outputs it to output stream.
    Interface
    Parameters
    NameTypeDescription
    target*stringPath of the source file.
    streamdataintegerSize of each data packet sent to output, in bytes.
    ValueDescription
    32768
    Output
    Data read from file.
    Samples
    File unzip
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <!--Read the input file, write to output -->
    <xdfl:FS_SET target="@@[VAL:ARG.dest]@@" >
    <xdfl:GZ_GET target="@@[VAL:ARG.org]@@" />
    </xdfl:FS_SET>
    <xdfl:OUTPUT >
    File @@[VAL:ARG.org]@@ Unzippped to @@[VAL:ARG.dest]@@
    </xdfl:OUTPUT>
    </XDFL>

    6.1.2. GZ_SET : Compressing to file

    The GZ_SET node compresses and writes input stream to specified file.
    Interface
    Input
    An XML or non-XML stream.
    Parameters
    NameTypeDescription
    target*stringThe path of the destination file.
    headerstringString to be written at he beginning of the file.
    actionstringIndicates an action to be performed on the file.
    ValueDescription
    flush(default) - The file is emptied before writting data.
    appendData is append at the end of the file.If the file does not exists, it is created.
    deleteThe destintion file is deleted.No data is written.
    Output
    The input stream.
    Side effects
    The input stream is compressed and written to destination file, or the file is deleted.
    Samples
    File zip
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <!--Read the input file, write to output -->
    <xdfl:GZ_SET target="@@[VAL:ARG.org]@@" >
    <xdfl:FS_GET target="@@[VAL:ARG.org]@@" />
    </xdfl:GZ_SET>
    <xdfl:OUTPUT >
    File @@[VAL:ARG.org]@@ zipped to @@[VAL:ARG.dest]@@
    </xdfl:OUTPUT>
    </XDFL>

    VII. multilang
    Multilingual pluggable module.

    7.1. Defining and using language-sets dictionnaries.

    7.1.1. _LANG_LOAD : Loading language set dictionnary.

    The _LANG_LOAD node loads a set of words and associates them with identification keys composed of the parent node names separated by ".". The first two levels are not involved in key composition but serve to provide a root for input stream, and designate the language code, respectively. The entries created are then made available by the intermediary LANG type parsed expressions, the current language code having been set beforehand with the help of the LANG_SET node. .
    Interface
    Input
    A XML stream defining a dictionnary
    Output
    The input stream.
    Side effects
    The defined dictionnaries are loaded in memory.
    Samples
    Loading and using language dictionnaries.
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <xdfl:_LANG_LOAD >
    <LANG_DATA >
    <!-- language code: EN	-->
    <EN >
    <labels >
    <title >
    SAMPLE TITLE
    </title>
    <help >
    Need help?
    </help>
    </labels>
    <errors >
    <fatal >
    <err_1 >
    Server unavailable
    </err_1>
    <err_2 >
    Invalid data
    </err_2>
    </fatal>
    </errors>
    </EN>
    <!-- language code: FR -->
    <FR >
    <labels >
    <title >
    TITRE D'EXEMPLE
    </title>
    <help >
    Vous avez besoin d'aide ?
    </help>
    </labels>
    <errors >
    <fatal >
    <err_1 >
    Le serveur est indisponible
    </err_1>
    <err_2 >
    Les données sont inconrrectes
    </err_2>
    </fatal>
    </errors>
    </FR>
    </LANG_DATA>
    </xdfl:_LANG_LOAD>
    <xdfl:LANG_SET code="EN" />
    <xdfl:OUTPUT >
    		@@[LANG:labels.title]@@ : 
    		@@[LANG:labels.help]@@
    	
    </xdfl:OUTPUT>
    </XDFL>

    7.1.2. LANG_SET : Setting current language.

    The LANG_SET node enables the choice of current language code. Values returned by LANG type parsed expressions change according to the language code. .
    Interface
    Parameters
    NameTypeDescription
    code*stringLanguage code to use for current script.
    Side effects
    The language code for current script is the indicated code.
    Samples
    Loading and using language dictionnaries.
    <?xml version="1.0" encoding="ISO-8859-1"?>

    <XDFL xmlns:xdfl="xdfl">
    <xdfl:_LANG_LOAD >
    <LANG_DATA >
    <!-- language code: EN	-->
    <EN >
    <labels >
    <title >
    SAMPLE TITLE
    </title>
    <help >
    Need help?
    </help>
    </labels>
    <errors >
    <fatal >
    <err_1 >
    Server unavailable
    </err_1>
    <err_2 >
    Invalid data
    </err_2>
    </fatal>
    </errors>
    </EN>
    <!-- language code: FR -->
    <FR >
    <labels >
    <title >
    TITRE D'EXEMPLE
    </title>
    <help >
    Vous avez besoin d'aide ?
    </help>
    </labels>
    <errors >
    <fatal >
    <err_1 >
    Le serveur est indisponible
    </err_1>
    <err_2 >
    Les données sont inconrrectes
    </err_2>
    </fatal>
    </errors>
    </FR>
    </LANG_DATA>
    </xdfl:_LANG_LOAD>
    <xdfl:LANG_SET code="EN" />
    <xdfl:OUTPUT >
    		@@[LANG:labels.title]@@ : 
    		@@[LANG:labels.help]@@
    	
    </xdfl:OUTPUT>
    </XDFL>

    7.2. Multilingual parsed expressions

    Once the language code has been positionned using the LANG_SET node, corresponding ntries can been retrieved using a LANG parsed expression.

    7.2.1. @@[LANG:dictionary_entry_name]@@ : insertion of the a dictionnary entry value

    Expressions of type LANG permit retrieving of dictionary values. The value returned depends on the language code chosen with the LANG_SET node.
    Interface
    Parameters
    NameTypeDescription
    dictionary_entry_namestringIndicates the name the dictionnary entry to insert

    VIII. crypto
    Cryptography pluggable module.

    8.1. Cryptographic functionnalities [Experimental].

    8.1.1. ENCRYPT : Data encryption.

    The ENCRYPT node encrypts input data and outputs encrypted data.
    Interface
    Input
    An XML or non-XML stream.
    Parameters
    NameTypeDescription
    key*stringThe encryption key used.
    algo*stringThe encryption algorithm used.
    ValueDescription
    rc4(default) - Use the RC4 algorithm. It is the only possible value.
    Output
    The encrypted input stream.
    Comments
    Decrypting encrypted data
    For Symmetric algorithms (like RC4) the ENCRYPT node is used for both encryption and decryption.
    Copyright (c) XDFLengine 2004