XML Completion |
Prev | Working with Plugins | Next |
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 (e.g. 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 folder when you choose
.
To produce your own meta DTDs, get dtdparse from
http://dtdparse.sourceforge.net.
Start Kate and open the configuration dialog under → . Then select XML Completion which will appear in the Application/Plugins section and close the dialog. After that, select → . 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:
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>”).
Entering these characters will offer closing the current element (nearest open one to the left of the cursor). Press Enter to accept the suggestion. Unlike the menu item, this works only with a DTD assigned.
The quote key will trigger a list of possible attribute values (if there are some) if you are inside a tag.
This key will trigger a list of possible attributes for the current element if you are inside a tag.
This key will trigger a list of named entities.
You can test all functions and limitations by loading
$KDEDIR/share/apps/katexmltools/testcases.xml
into Kate and following the instructions.
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 .
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 cannot find an open tag nothing will happen.
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.
Kate Plugin “XML Completion” copyright 2001,2002 Daniel Naber
<daniel.naber@t-online.de>
.
KDE SC 4 version copyright 2010 Tomáš Trnka
Documentation copyright 2001,2002 Daniel Naber
Prev | Contents | Next |
XML Validation | Up | Exporter |