# XML Completion

Daniel
Naber

    daniel.naber@t-online.de

2002-07-20
0.90.00

This plugin supports writing XML files by listing allowed tags and more.

KDE
kate
xml

# Introduction

This plugin gives hints about what is allowed at a certain position in an XML file, according to the file's DTD. It will list possible elements, attributes, attribute values or entities, depending on the cursor position (&eg; all entities are listed if the character on the left of the cursor is &). It's also possible to close the nearest open tag on the left.

The DTD must exist in XML format, as produced by the Perl program `dtdparse`. We will call a DTD in this format meta DTD. Some meta DTDs are supplied. They are installed in `$KDEDIR/share/apps/katexmltools/`, which is also the default directory when you choose Assign Meta DTD.... To produce your own meta DTDs, get `dtdparse` from http://dtdparse.sourceforge.net.

## How to Use

Start Kate and select Kate XML Completion which will appear in the Application/Plugins section under Settings Configure Kate... After that, select XML Plugin Assign Meta DTD. If your document contains no DOCTYPE or the doctype is unknown, you'll have to select a meta DTD from the file system. Otherwise the meta DTD that matches the current document's DOCTYPE will be loaded automatically.

You can now use the plugin while typing your text:

< (less than key)

  This will trigger a list of possible elements unless the cursor is inside a tag already. Note that you currently cannot use this to insert the top level element (e.g. <html>).

" (quote key)

  The quote key will trigger a list of possible attribute values (if there are some) if you are inside a tag.

(space key)

  This key will trigger a list of possible attributes for the current element if you are inside a tag.

& (ampersand key)

  This key will trigger a list of named entities.

## Features and Limitations

You can test all functions and limitations by loading `$KDEDIR/share/apps/katexmltools/testcases.xml` into &kate; and following the instructions. Note that working with more than one view per document is not yet correctly supported by this plugin.

## Menu Structure

XML Plugin Insert Element...

  This will open a dialog that lets you insert an XML element. The <, > characters and the closing tag will be inserted automatically. If you have selected text when this menu item is selected, the selected text will be surrounded by the opening and the closing tag. The dialog also offers completion of all elements that may be inserted at the current cursor position if you have assigned a meta DTD by using Assign Meta DTD....

XML Plugin Close Element

  This will search your text for a tag that is not yet closed and will close it by inserting the corresponding closing tag. The search starts at the cursor position and goes left. If it can't find an open tag nothing will happen.

XML Plugin Assign Meta DTD...

  This will tell the plugin which meta DTD to use for the current document. Note that this assignment will not be saved. You will have to repeat it when you start &kate; the next time.

## Thanks and Acknowledgements

&kate; Plugin XML Completion copyright 2001,2002 Daniel Naber daniel.naber@t-online.de.

Documentation copyright 2001,2002 Daniel Naber

&underGPL;