XFlows
v3.0
http://www.xflows.com
XML is the
acronym for eXtensible Markup Language. This is used for
interchanging structured data. XFlows helps you to automatize
your XML tasks like transforming by XSLT, importing data into a
database
and much more. A Scenario is a set of
ordered XML tasks. XFlows is both a scenario builder and runner.
XFlows has two usage modes :
- An easy-to-use User Interface for building and testing a scenario
- A console batch for running a scenario
I. XFlows Interface
The XFlows interface has three parts. A builder for integrating several
XML tasks into a scenario. A Runner for running a scenario and a Logger
for observing the running
state.
The interface has the following menus :
File
- New : Create a new scenario
- Open... : Open a scenario file from the file system. A dialog
will ask
a confirmation if the current scenario has been updated
- Save : Save the current scenario from the file system
- Save as... : Save the current scenario to the file system.
- Quit : Quit XFlows, a dialog will ask a confirmation if the
current scenario has been updated
Scenario
- Run : Run the current scenario. The Runner panel will be
automatically activated.
- Stop : Stop the current scenario running. Note that it will not
interrupt the current task
Options
- Preferences... : Read/Write the user preferences for sample for
choosing the number of tasks. Note that you must restart XFlows after
updating
- External Tools... : Call an external command
- Check the last version... : Ask to the xflows website if a new
version is available
- Plug a new parser... : Install a custom JAXP compatible XML parser
- Plug a new transformer... : Install a custom JAXP compatible XSLT
Engine
- XML catalog... : OASIS catalog for parsing with a local schema
Help
- Manul : This manual
- User interface... : Show the menu content
- Tip of the day... : Show an XFlows tip
- Report a bug... : Simple Form for sending an XFlows Bug
- Feature request... : Simple Form for sending an XFlows feature
request
- Support... : A dialog displaying support information like email...
- Release NEWS... : A dialog displaying the last XFlows News for a
version
- Register... : A dialog for registering providing a name and a
key. Go to the xflows site for
more information.
- About... : Information about the XFlows version
a. Builder
This is a major part of the interface. It is used for building a
scenario. A scenario is a set of XML tasks. For example, copying XML
files from FTP and transforming it by XSLT is a very simple
scenario with two tasks.
The interface has two parts :
- A list of ordered tasks. Each task has the following information
: A number, A title, A type
- A panel for parametering the selected task
Each time the user select a type, the bottom panel is updated showing a
set of fields bound to the selected type. For sample, if the type is
XSLT, then the bottom panel displays
the available parameters for running this task.

This screenshot is for a scenario sample with 3 tasks, the first one
and the
second one are for transforming by XSLT and the last one is for copying
the XSLT results.
The user can act on the selected task with the right buttons from the
titlebar :
Move the selected task to the
previous order number
Move the selected task to the next
order number
Delete the selected task
Run the selected task
Note that by default the mask number of tasks is limited to 20. The
user can reset this
value updating the preference xflows
/ maxTask.

In this screenshot, we show the
bottom part of the builder. This is the
parameters for the selected task. The interface will depend on the task
type. In this screenshot this is for
an XSLT task, that's why we have all the required information for
applying a transformation. We comment each
parameter in the part II.
The user can copy all the parameters
and paste it in a similar task
using respectively

and

.
Note that this action will also works with different types. For sample,
if you
copy the parameters of the XSLT and paste inside the DELETE task, the
xml source path and filter will be paste.
b. Runner
When building a scenario from the
Builder part, it is needed to test
the scenario or simply to run it because we don't want to use it in a
batch mode. The runner interface
part is for this purpose. It looks like the Builder part with a
Tasks list in the top and a Logs
list in the bottom.

The tasks list cannot be edited, the
user can act for running the
scenario or stopping it with

or

. Note that the first icon is the
same inside the Builder but there's a different
meaning because inside the Builder this is for the selected task and
inside the Runner this is for the scenario. You
will find also the same actions inside the Scenario menu and inside the
general toolbar.
When running a scenario, each task will produce one or several
messages. Each message has the following meaning :
Information, this is to know the
current task activity like Processing a file...
Warning, the task can work but
something may be wrong like copying an empty directory... Note that the
scenario will not be stopped in this case
Error, the task has generated a
problem like a problem for accessing to FTP... In this case the
scenario running is interrupted.
All the logs are stored inside the bottom panel :

In this screenshot, we start a first
task "XSLT for the source1" having
a problem. The stylesheet cannot be found. So the scenario is
interrupted. The action

is for cleaning the current logs.
Note : The default behavior
interrupting the scenario running when an
error is found can be disabled using the preference xflows / interruptOnError.
c. Logger
When running a scenario from the
batch mode you must know when something goes wrong. The Logger panel is
a set of parameters for activating various logging levels. It is
divided
in three parts :

The first one is the file logger. It
is dedicated to each message level : Information, Warning and Error.
When activating, the user has to choose a local file path for
storing the logging result. Note that you can store all the messages
(info, warning and error) in the same file, this is sometimes useful
for tracing the problems. This file usage will only work for the batch
mode.
Note that this is not the responsability of XFlows to clean
automatically the logs,
however you can clean it using the XFlows interface too.

This second one is for mailing the logs to a user. This option requires
to set various preference for accessing to an mail SMTP server :
- mail / from : This is the
sender of the e-mail because XFlows isn't a human being, it has no mail
account. Some SMTP server will require a valid e-mail sender
- mail / smtpHost : This is
the SMTP server address like 'smtp.myProvider.com'
- proxy / host and proxy / port : Only required if you
use a proxy for accessing to the internet
Note that if activating the Info mail logging, you may receive a lot of
mails because each logging message will be sent like 'Processing the
file ...'.

This last part is for reading / deleting file logs. Once having a file
log path from the first panel, you can display the content clicking
to the following buttons
,
and
respectively for the information, warning and error message types. The
red cross is for deleting the
displayed logs. If you have a massive log file, it is advised to delete
it from your file system rather than by the interface because you
needn't to display the full content.
d. Preferences
A preference is an application
parameter. This is a way to update the default behavior of the
application. All the preferences are stored inside the user account
inside the YourHome/.xflows/pref.prop file. So running XFlows inside
another account will need to update the required preferences. For
helping the user to synchronize the preferences into different
locations there are the actions

and

, the first one if for writing the
user preferences into a file and the last one for inserting it.
Note that after updating at least one preference, you must restart
XFlows.
Various preferences are used for setting a default value inside the
task parameter fields.
We describe below the available preferences :
| concat |
roottag : Default root tag for
the final document
sourcefiler : Default file filter for the source path
|
| defaultpath |
source: Default path for
the source field
project : Default path for the scenario file. This is updated
automatically
target : Default path for the target field
|
| docbook |
sourceFilter : Default source
filter
targetName : Default result name
|
| fop |
sourceFilter : Default source
filter
targetName : Default result name |
| htmlxml |
sourceFilter : Default source
filter
targetName : Default result name |
| interface |
lookAndFeel : The default java
look-and-feel
tipOfTheDay : Activating the first tipOfTheDay dialog
logFirstColor : First color for the log table line
logSecondColor : Second color for the log table line
tableFirstColor : First color for the task table line
tableSecondColor : Second color for the task table line
|
| mail |
emailFrom : User mail sender for
the xflows logging mails
smtpHost : Mail SMTP server location
|
| proxy |
host : Proxy host, must be empty
for disabling this feature
port : Proxy port, must be 0 for disabling this feature
|
| shortcut |
This is the shortcuts for the
interface menu
|
| xflows |
directory from the XFlows
directory
defaultSourcePath : The initial directory for all the source fields
(from the task parameters)
defaultTargetPath : The initial directory for all the target fields
(from the task parameters)
maxTask : Number of available tasks
interruptOnError : Cause the scenario to be interrupted when meeting an
error
|
xmlConfig
|
parser : A JAXP compatible
parser, by default XERCES
transformer : A JAXP compatible transformer, by default XALAN
|
| xslt |
sourceFilter : Default source
filter
targetName : Default result name |
Note for installing a new Parser or XSLT Engine look at the part V.a.
II. XFlows Tasks
a. File filters
A file filter is a regular expression for extracting only a subset of a
directory content. It is used by many tasks for filtering a
source directory .
For sample :
- (.*)\.* : Means all the files with a file extension
- (.*).xml : Means all the files terminating by xml
- (.*).html : Means all the files terminating by html
When the file filter field is empty, this regular expression is used
"(.*)\.*".
By running a task working on a source directory, the task will get
each file name and will test if this one matches the regular
expression, if this is not the case the file will be ignored. Thus by
using for sample "(.*).dat" it means we process only the files
terminated by "dat".
The parenthesis are important because
it gives information on how a result name can be built from a source
name. For sample if you have a file name "test.xml" and if you apply a
transformation, you would like a "test.html" file, and this is not only
the case for this file but for all the file terminating by "xml". So by
using a regular expression "(.*).xml" we can have a source file
"$1.html" matching all the part before the file extension.
$n means "Match all the content of the group n". A group is the content
inside the parenthesis. The number is the location of the group inside
the
expression. For sample (.*)\.(.*) will match the first file name part
before the extension inside the $1 and the last part inside the $2. In
this example for a document "test.xml" $1 will match "test" and $2
"xml".
Characters
|
Meaning
|
| x |
The character x |
| \\ |
The backslash character |
| \0n |
The character with octal value 0n
(0 <= n <= 7) |
| \0nn |
The character with octal value 0nn
(0 <= n <= 7) |
| \0mnn |
The character with octal value 0mnn
(0 <= m <= 3, 0 <= n <= 7) |
| \xhh |
The character with
hexadecimal value 0xhh |
| \uhhhh |
The character with
hexadecimal value 0xhhhh |
| \t |
The tab character ('\u0009') |
| \n |
The newline (line feed) character ('\u000A') |
| \r |
The carriage-return character ('\u000D') |
| \f |
The form-feed character ('\u000C') |
| \a |
The alert (bell) character ('\u0007') |
| \e |
The escape character ('\u001B') |
| \cx |
The control character corresponding to x |
| Character classes |
| [abc] |
a, b, or c
(simple class) |
| [^abc] |
Any character except a, b,
or c (negation) |
| [a-zA-Z] |
a through z or A
through Z, inclusive (range) |
| [a-d[m-p]] |
a through d, or m
through p: [a-dm-p] (union) |
| [a-z&&[def]] |
d, e, or f
(intersection) |
| [a-z&&[^bc]] |
a through z, except for b
and c: [ad-z] (subtraction) |
| [a-z&&[^m-p]] |
a through z, and not m
through p: [a-lq-z](subtraction) |
| Predefined character classes |
| . |
Any character (may or may not match line
terminators) |
| \d |
A digit: [0-9] |
| \D |
A non-digit: [^0-9] |
| \s |
A whitespace character: [ \t\n\x0B\f\r] |
| \S |
A non-whitespace character: [^\s] |
| \w |
A word character: [a-zA-Z_0-9] |
| \W |
A non-word character: [^\w] |
| POSIX character classes (US-ASCII only) |
| \p{Lower} |
A lower-case alphabetic character: [a-z] |
| \p{Upper} |
An upper-case alphabetic character:[A-Z] |
| \p{ASCII} |
All ASCII:[\x00-\x7F] |
| \p{Alpha} |
An alphabetic character:[\p{Lower}\p{Upper}] |
| \p{Digit} |
A decimal digit: [0-9] |
| \p{Alnum} |
An alphanumeric character:[\p{Alpha}\p{Digit}] |
| \p{Punct} |
Punctuation: One of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ |
| \p{Graph} |
A visible character: [\p{Alnum}\p{Punct}] |
| \p{Print} |
A printable character: [\p{Graph}] |
| \p{Blank} |
A space or a tab: [ \t] |
| \p{Cntrl} |
A control character: [\x00-\x1F\x7F] |
| \p{XDigit} |
A hexadecimal digit: [0-9a-fA-F] |
| \p{Space} |
A whitespace character: [ \t\n\x0B\f\r] |
| Classes for Unicode blocks and
categories |
| \p{InGreek} |
A character in the Greek block |
| \p{Lu} |
An uppercase letter |
| \p{Sc} |
A currency symbol |
| \P{InGreek} |
Any character except one in the Greek block
(negation) |
| [\p{L}&&[^\p{Lu}]] |
Any letter except an uppercase letter
(subtraction) |
| Boundary matchers |
| ^ |
The beginning of a line |
| $ |
The end of a line |
| \b |
A word boundary |
| \B |
A non-word boundary |
| \A |
The beginning of the input |
| \G |
The end of the previous match |
| \Z |
The end of the input but for the final
terminator, if any |
| \z |
The end of the input |
| Greedy quantifiers |
| X? |
X, once or not at all |
| X* |
X, zero or more times |
| X+ |
X, one or more times |
| X{n} |
X, exactly n times |
| X{n,} |
X, at least n times |
| X{n,m} |
X, at least n but not more
than m times |
| Reluctant quantifiers |
| X?? |
X, once or not at all |
| X*? |
X, zero or more times |
| X+? |
X, one or more times |
| X{n}? |
X, exactly n times |
| X{n,}? |
X, at least n times |
| X{n,m}? |
X, at least n but not more
than m times |
| Possessive quantifiers |
| X?+ |
X, once or not at all |
| X*+ |
X, zero or more times |
| X++ |
X, one or more times |
| X{n}+ |
X, exactly n times |
| X{n,}+ |
X, at least n times |
| X{n,m}+ |
X, at least n but not more
than m times |
| Logical operators |
| XY |
X followed by Y |
| X|Y |
Either X or Y |
| (X) |
X, as a capturing group |
| Back references |
| \n |
Whatever the nth
capturing group matched |
| Quotation |
| \ |
Nothing, but quotes the following character |
| \Q |
Nothing, but quotes all characters until \E |
| \E |
Nothing, but ends quoting started by \Q |
| Special constructs (non-capturing) |
| (?:X) |
X, as a non-capturing group |
| (?idmsux-idmsux) |
Nothing, but turns match flags on - off |
| (?idmsux-idmsux:X) |
X, as a non-capturing group with the
given flags on - off |
| (?=X) |
X, via zero-width positive lookahead |
| (?!X) |
X, via zero-width negative lookahead |
| (?<=X) |
X, via zero-width positive lookbehind |
| (?<!X) |
X, via zero-width negative lookbehind |
| (?>X) |
X, as an independent, non-capturing
group |
b. Xslt
The XSLT task can transform using a stylesheet one or several XML
files. We
have the following parameters :
- XML Source path : A directory or a file name. If this is a
directory the next field will be used. Look at the section a. for usage.
- XML Source filter : A filter working with a regular expression.
Look at the section a.
for usage.
- Stylesheet path : A path to an XSLT stylesheet.
- Version : This is the XSLT version 1.0 or 2.0.
- Parameters : A set of XSLT parameters. These parameters can be
used with the param tag inside your stylesheet
- Target path : The result directory or file name.
- Target name : A name built thanks to the source filter. Look at
the section a. for
usage.
c. Fop
This task will convert FO files to PDF .... We have the following
parameters :
- FO Source path :A directory or a file name. If this is a
directory the next field will be used. Look at the section a. for usage.
- FO Source filter : A filter working with a regular expression.
Look
at the section a. for
usage.
- Output type : The result document type : PDF, MIF, XML, PCL, PS,
TXT, SVG.
- Target path : The result directory or file name.
- Target name : A name built thanks to the source filter. Look at
the section a. for
usage.
d. DocBook
This task will convert DocBook documents to PDF... We have the
following parameters :
- DocBook Source path : A directory or a file name. If this is a
directory the next field will be used. Look at the section a. for usage.
- DocBook Source filter : A filter working with a regular
expression.
Look at the section a.
for usage.
- Output type : The result document type : HTML, HTML Help, XHTML,
Java Help, FO, PDF, XML, PCL.
- Target path : The result directory or file name.
- Target name : A name built thanks to the source filter. Look at
the section a. for
usage.
e. HtmlXml
This task will convert a set of HTML documents to XML. We have the
following parameters :
- HTML Source path : A directory or a file name. If this is a
directory the next field will be used. Look at the section a. for usage.
- HTML Source filter : A filter working with a regular expression.
Look at the section a.
for usage.
- XML Target path : The result directory or file name.
- XML Target name : A name built thanks to the source filter. Look
at the section a. for
usage.
f. DbExport
This task can extract data from your
database and store it inside an
XML document. This task works with an SQL query getting various values
(select ... from ...).
Each value is integrated inside an XML template which is concated for
each record. The final document is embedded inside a tag which can be
changed with the following preference : dbexport / roottag. The default
one is "xflows_export". The document is saved to the local file system.

We first need to establish a database
connection. The first step is to select a database type. In this sample
we choose MySQL. After the selection, the database url field is updated
with
a template the user must complete. The user id and password may be
filled too. Then the button "Connect" must be pressed. If the
connection is started, the left tree (database browser) will display
the database content. In this sample, we browse a very simple database
"persons" containing one table "person". Each table field is accessible
by opening a table node, under each field somes notes about the type
and the size of the data are accessible.
Look at the part V. b.
for using a custom database.

The second step is to create an SQL
query with an XML output template. The first one will get various
values from our database and the last one will help us to create the
final document. Each SQL field like "address" in our sample can be
included inside the XML template inserting before the "$" caracter. We
can generate the query and the XML template from the selected table
clicking

. We can also include one
field using the

action. The resulting test will
work on the first 10 records clicking this action

.

In this last panel we set the final XML document location.
g. DbImport
This task can update a database with
data from an XML document. This
panel works with differents sub-panels. The goal is to create a set of
parameters, each one is bound to an XML part with an XPath
query. These parameters are reused inside an SQL template generating
one or several SQL requests for updating the database.

We first need to establish a database
connection. The first step is to select a database type. In this sample
we choose MySQL. After the selection, the database url field is updated
with
a template the user must complete. The user id and password may be
filled too. Then the button "Connect" must be pressed. If the
connection is started, the left tree (database browser) will display
the database content. In this sample, we browse a very simple database
"persons" containing one table "person". Each table field is accessible
by opening a table node, under each field somes notes about the type
and the size of the data are accessible.
Look at the part V. b.
for using a custom database.

Here the second panel after setting
the good connection parameters.
This panel has a tree containing some nodes. Each node is an XML
parameter and each XML parameter has a name and an XPath query. The
XPath query is an absolute one when the node is under the root node
(called XML Source) or a relative one when the node is under another
node with
an XML parameter.
To understand this system, we suppose we have a document with a
"persons" root tag and a set of "person" tags like that :
<persons>
<person firstname="a" lastname="b"
address="c"/>
...
</persons>
We want to integrate all the person
elements. So we create a first
param (called "persons" in the present instance) with an XPath query
"/persons/*" matching all the person elements. This is an absolute
query because it is applied from the root node <persons>, so it
is added as a new node below the root node ("XML Source").
We need now to extract all the attribute value, so we insert inside the
last added node a relative query working for each "person" element.
For instance, we add a parameter matching the lastname value
(@lastname).
If the "person" had a needed text content we could have used this XPath
query
"text()".
Here the final tree showing the XPath queries :
XML Root
|
/persons/*
|
@firstname
When running the task, XFlows detects
that a query generates several
nodes and update for each node the SQL template (look at the panel
below). Note that you can't in this version have several nodes
containing relatives nodes. You can have only one query matching
several nodes.
However, you can have several queries matching a (non node) value under
the root node.
For more information about the XPath 1.0 syntax look at the W3C site : http://www.w3.org/TR/xpath

This last panel defines an SQL request template. This SQL request will
be used to update your database. The task will resolve (by XPath) the
previous parameters values and replace each parameter inside the
template for building a final query.
In this sample the following document
<persons>
<person firstname="a" lastname="b"
address="c"/>
<person firstname="a2" lastname="b2"
address="c2"/>
...
</persons>
with the following SQL request :
INSERT INTO person ( lastname ) VALUES ( $lastname )
will generate this final requests :
INSERT INTO person ( lastname ) VALUES ( b )
INSERT INTO person ( lastname ) VALUES ( b2 )
...
XFlows can help you to create and test your query with the following
actions :
Create a new SQL template using
the selected database Table
Insert the selected parameter
Test the SQL resolution for the
first 10 nodes. It will not
update the database.
Note that this Xflows task is limited to one SQL template.
h. Concat
This task will concat a set of files into a new one. We have the
following parameters :
- XML Source path : A directory or a file name. If this is a
directory the next field will be used. Look at the section a. for usage.
- XML Source filter : A filter working with a regular expression.
Look at the section a.
for usage.
- XML Target file : The final file name.
- Root tag : The main document element.
i. Copy
This task will copy a set of files from a local or a remote directory
(FTP) to a local or a remote directory.
Source type : By the local file system FILE or by FTP
Source path : A local / remote directory. If this is a directory the
next field will be used. Look at the section a. for usage.
Source filter : A filter working with a regular expression. Look at the
section a. for usage.
Target type : By the local file system FILE or by FTP
Target path : The result local / remote directory.
j. Delete
This task will delete a set of files from a local or a remote directory
(FTP).
Source type : By the local file system FILE or by FTP
Source path : A directory or a file name. If this is a directory the
next field will be used. Look at the section a. for usage.
Source filter : A filter working with a regular expression. Look at the
section a. for usage.
k. Parse
This task will check the well-formed or valide status of a set of XML
documents.
XML Source path : A directory or a file name. If this is a directory
the next field will be used. Look at the section a. for usage.
XML Source filter : A filter working with a regular expression. Look at
the section a. for
usage.
Validating : Decide to validate the document with a schema (W3C Schema,
DTD).
l. XQuery
This task will transform your XML documents with an XQuery expression.
XML Source path : A directory or a file name. If this is a directory
the next field will be used. Look at the section a. for usage.
XML Source filter : A filter working with a regular expression. Look at
the section a. for
usage.
XQuery path : A path to your XQuery expression document
Output : XML or text output. XML will indent the result document
XML Target path : The result directory or file name.
XML Target name : A name built thanks to the source filter. Look
at the section a. for
usage.
m. CSV
This task will convert Excel document to an XML document
CSV Source path : A directory or a file name. If this is a directory
the next field will be used. Look at the section a. for usage.
CSV Source filter : A filter working with a regular expression. Look at
the section a. for
usage.
Parameters : Your CSV format parameters like the type of the column
separator
Target path : The result directory or file name.
Target name : A name built thanks to the source filter. Look
at the section a. for
usage.
III. Scenario sample
a. Transforming by
XSLT and publishing
We propose here a simple scenario for
publishing in HTML a set of XML files. We suppose we have several XML
files located inside the /tmp/xmlinput
directory and we would like to
publish it inside our FTP server. We use an XSL Transformation to have
HTML documents. So we
need to create two tasks :
- Transforming a set of XML Files
- Copying a set of resulting HTML Files

We create a first task selecting the "XSLT" Action. We update the name
and select the XSLT Action
and we edit the parameters below :

Here the content of the first task.
In this sample, we transform all the xml files from the /tmp/xmlinput
directory using the /tmp/stylesheet/person.xsl
XSLT file. The output is
stored inside the /tmp/xmloutput
directory. The file name will be
convert from .XML to .HTML using a regular expression (look at the
section II.a. of the
manual).
We create now a second task selecting the "COPY" action with the
following parameters :

In this previous screenshot, we get all the html
files of the /tmp/xmloutput
and we copy it inside our remote server to
the /test directory.
We run our scenario with this action from the main toolbar
or from the scenario menu and we
have the following logs :

All our personX.xml files are well converted to HTML and stored inside
our FTP server.
b. Exporting from a
Database and publishing
We propose here another scenario extracting data from a database and
publishing it inside a website.
We suppose we have one database "persons" containg one table "person"
with the following content :
mysql> select * from person;
+-----------+----------+--------------------+
| firstname | lastname |
address
|
+-----------+----------+--------------------+
| victor | georges | 10, indiana street |
| joanna | georges | 11, indiana street |
| paul | georges | 12, indiana
street |
| herbert | georges | 13, indiana street |
| isidor | georges | 14, indiana street |
+-----------+----------+--------------------+
5 rows in set (0.00 sec)
We begin to create a new task for exporting the database "persons". We
select the first line of the tasks table and we select the "DBEXPORT"
Action. We also update the name field.

We begin by connecting to our
database located at jdbc:mysql://127.0.0.1/persons.
This name is
depending on the current database type, the user has only to complete a
part of the database url. We include too a user id and a password. Then
we
connect to the database. We have now the browser displaying our
"persons" database content.

In the second step we select the "Export" panel and we generate a new
SQL query for our table "person" by clicking on
.
It generates an SQL query for each field of our table and a template
for creating an output document. We test our query by clicking on
. It generates the following dialog
:

This dialog contains a subset of our final XML document.
The final result path is set by using the last panel "Target". We
decide to store it inside this path
/home/test/xflows/dbexport/test1.xml.
Now we create second task for transforming our previous document to
HTML using XSLT.
We create a simple stylesheet "export.xsl" for this result document
using our
favorite XML editor (like editix
: http://www.editix.com).
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/TR/xhtml1/strict"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/xflows_export">
<html>
<body>
<xsl:apply-templates select="record"/>
</body>
</html>
</xsl:template>
<xsl:template match="record">
<p>
<xsl:value-of select="firstname"/>
,
<xsl:value-of select="lastname"/>
,
<xsl:value-of select="address"/>
</p>
</xsl:template>
</xsl:stylesheet>
We insert another task for transforming our database result to
HTML :

We need'nt the "XML source filter" or a "Target name" fields because we
are working on a whole document and not on a directory.
We run the
scenario with this action
from the scenario menu or from the main toolbar.
We can save our scenario or reuse it in a batch mode (look at the
manual for batch usage).
IV. XFlows Batch Mode
a. Linux / Unix / Mac
OS X
The XFlows installation directory has a bin/run.sh script. This script
needs a path to a scenario file (terminated by xfl). This script may
need to be changed in a runnable state using the chmod u+x run.sh command. Here a
sample of usage :
./run.sh ~/xflows/tutorial2.xfl
Starting xflows-1.0
[Fri Jan 14 17:34:41 CET 2005] Starting scenario
[Fri Jan 14 17:34:41 CET 2005] Starting [Export the table Person
from the database Persons]
[Fri Jan 14 17:34:42 CET 2005] Task [Export the table Person from
the database Persons] terminated in 1014 ms
[Fri Jan 14 17:34:42 CET 2005] Starting [Transform the previous
output result by XSLT to HTML]
[Fri Jan 14 17:34:42 CET 2005] Transforming
/home/test/xflows/dbexport/test1.xml
[Fri Jan 14 17:34:45 CET 2005] Task [Transform the previous
output result by XSLT to HTML] terminated in 2707 ms
[Fri Jan 14 17:34:45 CET 2005] Scenario Terminated
For scheduling a scenario using cron you can create a simple script
like that :
#!/bin/bash
/XFLOWS_DIR/bin/run.sh /home/test/myProject.xfl
The XFLOWS_DIR is your xflows installation directory. This
previous sample will run the myProject.xsl
scenario.
Note that XFlows is a java program, we fixed limited memory resource
usage thanks to the argument -Xms64m -Xmx512m inside the run.sh script.
The 64m means our program will have a 64 Mb stack and 512Mb means it
will allocate until 512 Mb for the heap.
For having file logs or receiving mails look at the part I. c.
b. Windows XP...
The XFlows installation directory has a bin\run.bat script. This script
needs a path to a scenario file (terminated by xfl). Here a sample of
usage :
run.bat c:\xflows\tutorial2.xfl
Starting xflows-1.0
[Fri Jan 14 17:34:41 CET 2005] Starting scenario
[Fri Jan 14 17:34:41 CET 2005] Starting [Export the table Person
from the database Persons]
[Fri Jan 14 17:34:42 CET 2005] Task [Export the table Person from
the database Persons] terminated in 1014 ms
[Fri Jan 14 17:34:42 CET 2005] Starting [Transform the previous
output result by XSLT to HTML]
[Fri Jan 14 17:34:42 CET 2005] Transforming c:\test1.xml
[Fri Jan 14 17:34:45 CET 2005] Task [Transform the previous
output result by XSLT to HTML] terminated in 2707 ms
[Fri Jan 14 17:34:45 CET 2005] Scenario Terminated
For scheduling a scenario, you can create a simple batch for each
scenario like that :
c:\XFLOWS_DIR\bin\run.bat MyScenarioPath
And use the Microsoft Task Scheduler. Note for the scheduler :
"To use the scheduling service on Windows 98, NT, 2000, click on
the My Computer icon located on the Desktop. Then double-click on
Control Panel to get to the Scheduled Tasks folder. On Windows XP and Server 2003 you
can access this from the Start Menu and clicking on Settings and then
Control Panel to Scheduled Tasks. Double-click Add Scheduled Task.
Follow the instructions in the Add Scheduled Task wizard. Select the
Open advanced properties for this task for more set up options."
Note that XFlows is a java program, we
fixed limited memory resource
usage thanks to the argument -Xms64m -Xmx512m inside the run.bat
script.
The 64m means our program will have a 64 Mb stack and 512Mb means it
will allocate until 512 Mb for the heap.
For having file logs or receiving mails look at the part I. c.
V. Extend XFlows
a. Installing a new
parser or XSLT transformer
Click on the item 'Plug a new parser' or 'Plug a new transformer'
inside the Options menu.
Add your java Jar(s), click on the button Search a JAXP class. If a
class name appears under the class name field your JAXP parser is
found. You may also enter manually the JAXP class name and check with
the bound button. Press OK and the parser or the transformer is enabled
the next time you
restart Xflows.
Another option :
- Insert a java class name (JAXP compatible) inside the parser or
transformer field of the xmlConfig
preference
- Copy respectively your parser jars and your transformer jars
inside the XFLOWS_DIR/ext/parser and XFLOWS_DIR/ext/xslt directories
- Restart XFlows. If the parser or the transformer can't be used a
message will be displayed inside the console.
Here a sample for installing the SAXON XSLT Engine :
- Download SAXON (http://saxon.sourceforge.net)
- Copy saxon.jar to the XFLOWS_DIR/ext/xslt
- Modify inside the XFlows UI the preference xmlConfig /
transformer with the value com.icl.saxon.TransformerFactoryImpl
- Restart XFlows
b. Installing a new
database driver
Copy your JDBC driver jar(s) inside the
XFLOWS_DIR/res/db directory. Then modify the
XFLOWS_DIR/res/dbxflows.xml to insert your JDBC entry like that :
<db name="Your driver name "
driver="Your driver class" url="Your URL" archive="Your Jars separated
by a ';'"/>
And restart XFlows.
VI. XFlows Components
This product uses :
VII. Tasks API
Users can extend the default XFlows tasks writting its own task. A task
is built in the JavaTM Language.
Two interfaces (provided by the lib/xflows.jar file) must be
implemented :
package com.japisoft.xflows.task;
/**
* @author (c) 2005 JAPISoft / http://www.japisoft.com
* @version 1.0
* */
public interface TaskRunner {
public static boolean ERROR
= false;
public static boolean OK =
true;
public boolean run(
TaskContext context );
}
This is an interface for running a task. The user must implement the run
method writting the code for the task. A parameter TaskContext
is here for providing information to the task like the final user
parameters provided in XFlows.
package com.japisoft.xflows.task;
import javax.swing.JComponent;
/**
* Here the interface for defining a task User Interface. Thus
users can
* choose some parameters value (file path...) for the task working
* @author (c) 2004 JAPISoft / http://www.japisoft.com
* @version 1.0
* */
public interface TaskUI {
/** Here the task params.
This is the area for storing / restoring parameters value */
public void setParams(
TaskParams params );
/** @return the user
interface part */
public JComponent getView();
/** Called once when using
this task ui */
public void start();
/** Called once when
stopping using this task ui */
public void
stop();
}
This is the interface for letting the final user choosing its
parameters. A TaskUI provides a user interface with a set of fields
through the getView method. The method setParam
is called once and provide an objet TaskParams that the
developer must update with the final user data. When the user interface
is shown the start method is called and when the final
user parameters must be taken into account the stop method is called
once.
Once your task built, a java jar must be built (using the java jar
command).
For using this task inside XFlows, select the 'Tasks...' item from the
'Options' menu.

Click on the "Add a task" button. A wizard will appear and you will
have to select your jar and your classes. Then restart XFlows for using
the new task.
Note : The directory
tasks inside the XFlows distribution contains a sample and the javadoc
for more information.