Table of Contents
Table of Contents
Welcome to the XAE User's Guide. This guide explains how to use the XAE to create, display, and transform XML documents.
The XML Authoring Environment (XAE) for Emacs is a software package that allows you to use Emacs (or XEmacs) to create, display, and transform XML documents. Features include:
The XAE runs on all platforms that support Emacs and Java. This includes all versions of Windows and most Unix and Linux systems.
The XAE requires that the following software packages be installed on your system.
Emacs or XEmacs
Java runtime environment
eieio object-oriented Lisp programming package for Emacs
Table of Contents
This chapter aims to teach you the basics using the XAE by taking you step-by-step through the creation of a simple XML document entitled The Short Book. We start by creating a skeleton document.
To create the skeleton document,
Select Files->XAE->Book from the Emacs menubar.
The XAE prompts you to enter the title of the new book.
Enter "The Short Book" at the prompt and press the Enter key on your keyboard.
The XAE creates the skeleton document.
Save the new book.
Use the Files->Save Buffer As... (C-x C-w) command to save the buffer. You can save the book in the current directory or any other suitable place on your file system.
Table 2.1. Skeleton Book File Contents
Line |
Contents |
---|---|
1 |
XML processing instruction for this document. This processing instruction identifies this document as an XML document. |
3 |
Document type declaration for this document. It declares this book to be an instance of the Docbook document type. |
5 |
Style sheet processing instruction for this document. The processing instruction associates this document with the Docbook HTML stylesheet. The Docbook HTML stylesheet converts this document from XML to HTML. |
7-12 |
Initial elements of this book. |
14-21 |
default psgml-mode settings for this document. psgml is an Emacs Lisp package that provides the XAE with XML structured editing capabilites. When Emacs loads this document, it sets buffer-local copies of the specified psgml customization variables to the specified values. |
Now let's add some content to the Short Book. First, insert the word "Introduction" into the title element of the first chapter. Next, let's use the XAE's structured document editor (psgml mode) to add a first paragraph to the introductory chapter. In so doing, we will learn how to use the editor to create elements.
To add the paragraph element:
Position the Emacs text cursor anywhere between the end of the first chapter's title element and the end of the first chapter.
Select Markup from the Emacs menubar.
You should see a "parsing DTD" message in the Emacs minibuffer. This indicates that Emacs is parsing the Docbook DTD of which "The Short Book" is an instance. The Docbook DTD has more than 300 elements. However, parsing it should take no longer than 30 seconds. If it seems to be taking a very long time, it is probably because you have not byte-compiled the PSGML lisp code. If not, you should kill and restart Emacs and byte-compile PSGML before proceeding further.
When Emacs is done parsing the DTD, it displays a menu of elements that you can create after a chapter title.
Select para from the menu.
Emacs inserts a para element after the title element and positions the Emacs text cursor inside the element so that you can enter the element's content.
Insert the sentence, "Welcome to a very short book." in the element.
Suppose that we want to emphasize "very" in the sentence we just added. We can do this by tagging the word as a Docbook emphasis element.
To emphasize "very" in the sentence we just added:
Select the region of the Emacs buffer containing "very."
Select Markup->Tag Region from the Emacs menubar.
Emacs displays a menu of elements that you can create around the selected region at this point in the document.
Select emphasis from the menu.
Emacs inserts an emphasis start and end tag around "very" in the buffer.