Convert to XML on the fly

xmlfy 1.5

The xmlfy command is a powerful yet lightweight tool that primarily caters for converting ASCII, UTF-8, UTF-16 or UTF-32 based output into XML format on the fly and dealing with common issues associated with this kind of transformation. xmlfy can be invoked from the command line or from within a shell script to transform data quickly, easily and reliably.

xmlfy provides many features and options to capture and encapsulate data between XML tags for both simple and complex XML tree hierarchies. The behaviour of xmlfy is controlled by arguments and/or by specifying a schema file providing high levels of flexibility and customisation for differing input scenarios.

The xmlfy command reads unprocessed stdin and outputs it to stdout in XML format.
How it works

The simplest way of using xmlfy is described by the following example:

% ps | xmlfy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xmlfy SYSTEM "xmlfy.dtd">

A more sophisticated use of xmlfy is described by the following example:

% xmlfy -k -F2:1 : -E 'c1-1/#/' -T0 name a2ps-site-cfg -t < /etc/a2ps-site.cfg
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE a2ps-site-cfg SYSTEM "xmlfy.dtd">
  <DefaultPrinter>¦ #{lp.default}</DefaultPrinter>
  <UnknownPrinter>¦ #{lp} #o</UnknownPrinter>

With the increasing presence of object-oriented systems requiring well structured data presentation, xmlfy allows you to convert your raw data into XML format easily which can then be used as input for modern object-oriented systems e.g. XML style sheets (XSLT).

xmlfy is predominantly written to alleviate the need for writing custom scripts for this purpose and to produce consistent outcomes in dealing with this kind of transformation problem.

You can download xmlfy from here.

Arthur Gouros, xmlfy founder, 2008.