Table of Contents
xfront is a frontend to support writing XML documents in a style similar to C/C++/Java, using curly brackets to specify scopes of elements. xfront has been developed to get around writing documents in the rather intricate XML syntax.
xfront has been created to aid developers who are in the need of writing documentation. Developers usually tend to prefer the C/C++/Java style syntax to write their programs, and with time and practice, they get very fast writing source code. xfront tries to support this style, and wants to attack prejudices against writing XML documents.
Additionally, XML documents are not really adequate to be used in collaboration with revison control systems. The syntax xfront expects does not incorporate redundand and distracting XML closing element names, and so it is easier to read and - in case of revision control - easier to compare visually.
xfront tries to support concise writing using element name aliases and element name combiners. Both very helpful for writing documents using verbose XML DTDs like DocBook.
This text has been created using xfront and DocBook.
The syntax of xfront input files is based on scoped areas enclosed by '{' and '}' curly brackets. The '\' backslash character is used to escape characters which would confuse the lexical analysis.
Each scoped area is translated into the appropriate XML element.
XML element names are simply placed before a scope. xfront uses backtracking to query the element name.
Example 1. Simple element
section{ title{Introduction} }
produces:
<section> <title>Introduction</title> </section>
Whitespace is ignored at places where xfront scans for element names. All other whitespaces (including line feeds and tabs) are emitted to the resulting XML output.
The whitespace before an element name is emitted, to output elements without leading whitespace, you may escape the element identifier by the escape character '\'.
Example 2. Escaping
p{Here I em\em{pha}sized the second syllable.}
In this example the em element is escaped using the '\' character to produce the output:
Here I emphasized the second syllable.
To avoid whitespace prefixed in lines for literal layouts, leading whitespace can be removed by placing the scope introducing character '{' into a separate line.
If xfront detects a '{' in a separate line, it automatically removes the whitespace prefixes which are equal to the one seen before the '{' from all the lines in the associated element scope.
xfront [options] [filename...]
xfront processes all input files provided at the command line. In case there is no filename given, xfront expects input characters to arrive at standard input. If filenames are given, xfront generates an XML file for each input file. The output files get the same names like their input files with the extension changed to .xml. If no filename is specified, xfront writes the XML file to standard output.
For escaping '{' '}' or '\' use '\{' '\}' '\\', respectively.
To suppress whitespace before an element name, escape the element name using '\'.
To emit text directly to XML, use ":xml" as element name. Here, xfront will not convert '<', '>' or '&' to their appropriate XML entity representation.
Example 8. Emit text to XML
:xml{<?xml version="1.0" encoding="UTF-8"?>}
:xml{<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4/2/docbookx.dtd">}
For using umlauts, you may use ISO-8859-1 encoding instead of UTF-8.
In case of verbose element names, use alias files and use the '/' character to combine multiple element names.
xfront is part of the Libsmart library. The xfront project is located at the directory tools/xfront. To compile and install xfront type make install in that directory.
Here is a list of the files installed:
xfront installation files
Binary directory (usually /usr/local/bin)
Data directory (usually /usr/local/share)
xfront is not finished yet, following things are known to be required for version 1.0:
Support of (verbatim?) text where the special characters '{' and '}' are common. Parts of C/C++/Java source code are an example. Suggestion: '{{' and '}}' scopes.
Support for XML comments. Suggestion: ':{' scope.
Required: vi and emacs syntax highlighting.
C/C++ style comments? Not sure about this. Currently they are supported but not part of the specification. Probably xfront needs to support two styles of comments, one comment type only appearing in the source, the other emitted as XML comments.
Support for combined aliases (like lip=li/p for example)
Includes???
Support entities for shared text.
Parsing of strings enclosed by '"' may confuse backtracking and users (inside strings '{' and '}' need not to be escaped), so '"' content parsing shall be avoided.
For some reason XML file line numbers differ from the line numbers of their original .xf files.
2003 12 08 Version 0.3.3:
support for escaping '/' characters using the backslash '\' character.
2003 09 03 Version 0.3.2:
implemented dynamic whitespace indent detection and removal
2003 09 02 Version 0.3.1:
fixed problem with detecting escaped parameter names
2003 09 02 Version 0.3:
fixed problem with string parsing (was longest match instead of shortest).
implemented aliases
implemented element combiners
Included some DocBook examples
2003 08 29 Version 0.2: Initial release
For the impatient ones wanting to write DocBook, here are some useful examples, inspired by the Docbook Crash Course.
You can read the original markup in xfront.xf.
Example E.2. Segmented list
Name: Fred
Address: Fred's street
Name: Bernd
Address: Bernd's street
Name: Felix
Address: Felix's street
Example E.3. Program listing
10 PRINT "HELLO WORLD" 20 GOTO 10
For PDF output, program listings must be aligned at column 1 in xfront input documents.
Example E.4. Warnings, Tips and Notes
Hot!
RTFM!
Big brother is watching you!
Always take the red pill
Low Battery
Example E.5. Links
External link.
Link to a known id in the same document: see Introduction.
My email address: <armin@replicator.org>