Chapter 2. XML Overview

Table of Contents

XML vs SGML
XML Maturity
XML and LyX
Lyx-1.1.6*
LyX-1.2.0

XML vs SGML

In many ways XML seems to be the future of DocBook: more (free) tools are developped for XML, and it begins to be widely used in the Internet land in contrary of SGML that grows slowly. A possible reason of this situation is that the XSL stylesheet format is easier to understand and to learn than the DSSSL format; thus, stylesheet customization (at least for a beginner) is encouraged with XML.

At the writer level, there is no main differences since the defined elements are the same, even if SGML is more flexible (i.e. the ability to minimize or omit tags). The main point to decide whether using XML instead of SGML is if the DocBook's SGML branch is planned to be obsoleted one day or not.

XML Maturity

Even if XML seems to be very promising, it is not mature enough, especially for printing documentation. Printed documentation tends to move one more toward DSSSL processors for output, and solid SGML tools chains exist that work as soon as it is installed. For instance the DocBook DTD / DocBook DSSSL / jade / [jadetex, pdfjadetex] chain is provided in the Red Hat distribution and works without big problems.

It seems that there are more XML tools, but the main problem is to make them work together! One step is to configure each of them, the other step is to manage specific configurations that make one work with another. For instance the XSL stylesheets provide some java archives, to add to the CLASSPATH to make the XSL processor used work!

XML and LyX

Lyx-1.1.6*

In release 1.1.6*, LyX does not directly support the DocBook XML format. Only DocBook SGML V3.1 is supported. However, the elements used are fully compliant to XML, and the SGML produced by LyX is well formed for XML.

In fact few things are needed to:

  • make LyX export as XML,

  • import XML files into LyX.

Exporting as XML

Since LyX uses an XML compliant output format, exporting as XML only means changing the output file header. For instance, in the main file of an SGML document (that is, not a file included in another one) the following SGML header:

<!doctype article public "-//OASIS//DTD DocBook V3.1//EN"
[...]>
    

should be changed to:

<?xml version="1.0" encoding="iso-8859-1"?> 
<!DOCTYPE article SYSTEM "file:///(full path to)/docbook/docbkx412/docbookx.dtd"
[...]>
    

Importing XML files

To import XML file into LyX, you can use the DB2LyX set of stylesheets, that translate any XML file to a LyX-1.1.6 file compliant format.

LyX-1.2.0

LyX version 1.2.0 is expected to be able to export as XML DocBook, and even import an XML DocBook document. However, it does not mean that LyX has changed its format to XML! In fact it is only that the processes described in the previous section will be integrated in this release.