nXML mode provides continuous validation and completion for DocBook, XHTML and other XML documents. You no longer need to know the XML schema by heart: nXML assists you in entering an element name, attribute name or data value allowed in the current context. It does not support DITA XML by default, however. This tutorial will help you using this Emacs mode to create DITA XML documents.
Prerequisite:
- Emacs
-
The DITA XML documentation project directory structure must be as follows:
.
└── <language directory>
├── concepts
├── faq
├── reference
├── tasks
└── topicswhere the <language directory> value is en_US, or fr_FR, etc.
- Command line instructions are meant for GNU/Linux ; they must be adapted for other environments.
- Backup your whole DITA XML documentation project.
-
Open a terminal, then paste the following set of commands:
cd && wget http://www.thaiopensource.com/download/nxml-mode-20041004.tar.gz && tar xzvf nxml-mode-20041004.tar.gz && wget http://www.technical-writer.org/media/nxml-mode-environmment.txt && cp .emacs .emacs.bak && cat .emacs | sed '$a\' > .emacs.tmp && mv .emacs.tmp .emacs && cat nxml-mode-environmment.txt >> .emacs && rm nxml-mode-environmment.txt
If you are prompted that the .emacs files does not exist, paste the following commands, then repeat this step:
cd && touch .emacs
This set of commands:
- Downloads and uncompresses the nXML mode archive
- Create a backup copy of the .emacs file (.emacs.bak)
- Writes the nXML mode environment variables in the .emacs file
- Download the DITA XML Relax NG schemas archive in your DITA XML documentation project root directory.
-
Change to your DITA XML documentation project root directory, then paste the following command:
tar xzvf rnc.tar.gz
This command creates a rnc directory at the same level as the <language directory>.
-
Download the schemas.xml files archive in your DITA XML documentation project root directory, then paste the following set of command (replace <language directory> by the actual name of the language directory en_US, or fr_FR, for instance). Repeat this step for all your language directories.
tar xzvf schemas.technical-writer.org.tar.gz && cd <language directory> && cp ../schemas.technical-writer.org/concepts/schemas.xml concepts/ && cp ../schemas.technical-writer.org/faq/schemas.xml faq/ && cp ../schemas.technical-writer.org/reference/schemas.xml reference/ && cp ../schemas.technical-writer.org/tasks/schemas.xml tasks/ && cp ../schemas.technical-writer.org/tasks/schemas.xml tasks/ && cp ../schemas.technical-writer.org/topics/schemas.xml topics/ && rm -rf ../schemas.technical-writer.org/
The schemas.xml files are now located in your language directories, for instance:
.
└── en_US
├── concepts
│ └── schemas.xml
├── faq
│ └── schemas.xml
├── reference
│ └── schemas.xml
├── tasks
│ └── schemas.xml
└── topics
└── schemas.xml -
Open a DITA XML (.dita) content file with Emacs.
The DITA XML syntax is highlited. Invalid parts of your document are underlined in red.
-
To insert a new tag, enter <, then press Ctrl+Enter.
The list of allowed tags appears.
- Select a tag, then presse Enter. Press Ctrl+Enter to display the list of allowed attribute names.
- To instert a closing tag after your text, enter </, then press Ctrl+Enter.