# The KXML Editor Handbook

Lumir
Vanek

    lvanek@users.sourceforge.net

2004
Lumir Vanek
&FDLNotice;
07/08/2004
1.11

KXML Editor is an application for browsing and editing XML files.

This document describes KXML Editor version 1.0.

KDE
KXML Editor

## Some Fundamentals

Extensible Markup Language (XML) is wide standart for exchanging and transferring data in application development. XML stores character data in a structured way, using tags placed within the data representing its structure. An XML document has a tree structure, where "XML element" tags comprise the nodes. The "root element", begets all the other elements in the tree. All elements except the root have a single parent. Elements may contain character data - "XML contents". An element node may also own a list of "attributes".

XML structure

You may obtain more informations about XML on Web.

## Introduction

KXML Editor is a program that lets you browse and edit XML files. Main window is divided to two windows.

Left side contain tree widget with XML structure. XML document has tree structute, one (and only one) element is root. Every element may own one or more childs elements or contents items.

Right side contain detail for selected item. If XML element is selectected in left side, attributes list and raw XML are displayied. If XML contents is selectected in left side, edit widget with full context is displayied.

Here's a screenshot of &kxmleditor;

KXML Editor contain two toolbars with buttons - one with standart commands and second with commands for edit XML document. Third toolbar contain Konqueror-like path bar, that display path of selected XML item.

The Pathbar shows the path to the selected XML item, You can type a path here and press Enter to go to it. You may use combobox in path bar for select bookmarked item. The black icon at the left hand end of the Pathbar clears the text entry box.

## Edit XML document

User may edit XML document using menu commands, or using drag and drop.

Moving elements using clipboard or drag and drop has one side effect to bookmarks system. Moving elements and their subtrees leave its paths in Pathbar combobox nonvalid.

When you cut/copy and paste items with bookmarks, or drag and drop it, bookmarks are not transfered.

### Using clipboard

To copy a XML element or contents item you can:

- If the item is selected you can use the Copy button on the Toolbar or the Menubar Edit Copy item, or the CtrlC hotkey.

- Then select item, where you can copy XML element.

- Finally, use Paste button or the Menubar Edit Paste option or the CtrlV hotkey.

Moving a XML element or contents item can be done in the same way as copying, except that you choose the Cut option or CtrlX instead of Copy.

You can also exchange XML between &kxmleditor; and text editor using clipboard. Of course, when you paste XML element, clipboard must contain well formed XML.

### Using Drag 'n Drop

&kxmleditor; supports Drag and Drop copying and moving of elements and contents items.

1. Set the tree view to show the item you wish to move. If you can copy, press Ctrl button and hold it.

2. Position the mouse pointer over source item name or icon then, holding the &LMB; pressed, drag it over to the tree view and position the mouse pointer over the target item. Release the mouse button and Ctrl if you made copy.

You can also drag and drop between different instances of &kxmleditor;. Also is possible drag from &kxmleditor; and drop into text editor.

### Encoding

&kxmleditor; supports XML document encoding.

When file is loaded, parser get information about encoding from processing instruction <?xml encoding="xxxx" ?> and convert XML to Unicode.

&kxmleditor; works internally with Unicode strings.

While saving, &kxmleditor; convert XML from Unicode to encoding that depends on processing instruction <?xml encoding="xxxx" ?>, where xxxx may be ISO-8859-1, ISO-8859-2, UTF-8 etc. If you change encoding, you change codec, that is used while saving.

### KParts

&kxmleditor; supports KParts technology.

If you browse directory using Konqueror, you may select XML file and click on it by right mouse button. Then you may choose menu item Preview in and KXML Editor that starts KXML editor inside Konqueror main window.

Special processing instruction dialog

## The Menu Entries

### The File Menu

CtrlN File New

  Creates a new XML document. If there is a current document with unsaved changes the user is given a chance to save it. Program show dialog for special processing instruction, you may choose XML version and encoding.

  Special processing instruction dialog

CtrlO File Open

  This command opens a file. It does this by means of a dialog box which allows the user to navigate the file system. The dialog operates like a small file manager. Clicking on directories displayed in the central window directs the dialog to enter that directory - displaying its contents. There is an entry/dropdown box which can be used to type in directly the location and name of the file or by clicking the arrow at the side choose from a dropdown list of recently used locations. Below this is a filter which similarly may have data entered directly or chosen from a dropdown list of recent filter types. The filter facility lets only files that meet its specifications be displayed in the central window. If the filter contained text such as `*.xml` then only files with the txt extension would be visible in the selection window. Below the filter is a status bar giving information about the number of files and subdirectories within the current directory.

  The toolbar, which is located at the top of the dialog, has left and right arrow buttons that let the user move back and forth through previously selected directories as well as an up arrow button for moving up the directory tree. The button with the little house takes the user to his or her home directory and the one with the two arrows curved in on each other updates the view of the current directory. The flag button lets the user set a new bookmark at the current directory or go to one that was previously set. The last button on the toolbar allows you to create a new directory, and finally there is dropdown box with a list of some commonly frequented directories.

File OpenRecent

  This is a shortcut to open recently saved documents. Clicking on this item opens a list to the side of the menu with several of the most recently saved files. Clicking on a specific file will open it in &kxmleditor; - if the file still resides at the same location.

CtrlS File Save

  This saves the current document. If there has already been a save of the document then this will overwrite the previously saved file without asking for the user's consent. If it is the first save of a new document the save as dialog (described below) will be invoked.

File Save As

  This allows a document to be saved with a new file name. This is done by means of the file dialog box described above in the Open section of this help file.

File Mail

  This allows mail document using your mail client.

File Version & Encoding

  Program show dialog for special processing instruction, you may choose XML version and encoding.

File Attach Schema

  This allow to attach DTD schema file.

File Detach Schema

  This allow to remove DTD schema file.

File Attach Stylesheet

  This allow to insert processing instruction for ataching schema (obviously .xsl or .xslt) file.

File Detach Stylesheet

  This allow to remove processing instruction for ataching schema.

File Print

  This allow print document.

CtrlQ File Quit

  Quits &kxmleditor;

### The Edit Menu

CtrlZ Edit Undo

  This is used to eliminate or reverse the most recent user action or operation.

CtrlShiftZ Edit Redo

  This will reverse the most recent change (if any) made using Undo

Edit->Undo/Redo History

  This will call a display box showing a list of the most recent actions on the left and another list of actions which have been 'undone' on the right. There are also three buttons at the right of the box labeled Undo, Redo, and Close. Clicking on the Undo button will cause the action at the top of the Undo list to be reversed which will place that particular action at the top of the Redo list. Likewise, clicking on the Redo button will reinstate the reversed action and move it back to the top of the Undo list. Clicking on an item below the top item in either list will select all the items from the top down to that point. A subsequent click on the corresponding button will cause all the selected actions to be undone or redone accordingly. This would be particularly useful when the user knows precisely the point to which she or he would like to proceed - making it unnecessary to go through a series of single undo or redo actions.

CtrlX Edit Cut

  This command deletes the current selection and places it on the clipboard. The clipboard is a feature of KDE that works invisibly to provide a way to transfer data between applications.

CtrlC Edit Copy

  This copies the currently selected text to the clipboard so that it may be pasted elsewhere. The clipboard is a feature of KDE that works invisibly to provide a way to transfer data between applications.

CtrlV Edit Paste

  This will insert the contents of the clipboard at the cursor position. The clipboard is feature of KDE that works invisibly to provide a way to transfer data between applications.

Del Edit Delete

  This will delete selected XML node, including their child subtree, if any

Edit Delete all attributes

  This will delete all attributes that contain selected XML element

Edit Move Up

  Move selected node Up, in their parent list

Edit Move Down

  Move selected node Down, in their parent list

CtrlE Edit Deselect node

  This unselect node

CtrlF Edit Find

  This opens the find dialog which is used to specify the Text to Find in the document. There is small text box for entering the search pattern. Other parameters are included to make the search more efficient. Selecting Case Sensitive will limit finds to entries that match the case (upper or lower) of each of the characters in the search pattern.

F3 Edit Find Next

  This repeats the last find operation, if any, without calling the find dialog box.

Edit Properties

  Display dialog which allows the user to change selected node properties. Dialog type depends on selected item type.

Edit Edit raw XML

  Display dialog which allows the user to edit selected element as raw XML.

  Special processing instruction dialog

  You may press Validate button for checking, if XML is well formed.

### The View Menu

Alt Up Arrow View To P arent node

  Go up a level in the tree hierarchy. Select parent node.

Ctrl Plus View Expand node

  Expand selected XML element and show entire child subtree.

  Tip: You may expand node to choosed level. Press button for this function on toolbar, hold mouse pressed for small anmount of time. Program show menu, which allows the user to expand node to selected level.

Ctrl Minus View Collapse node

  Collapse selected XML element and hide entire child subtree.

  Tip: You may collapse node from choosed level. Press button for this function on toolbar, hold mouse pressed for small anmount of time. Program show menu, which allows the user to collapse node from selected level.

### The Insert Menu

CtrlShiftE Insert Element

  Insert new XML element into tree. Display dialog which allows the user to enter element name. If you have void document, new element becomes root. If you have selected any existing element, new element becomes child of this element. You may decide, if new element will be placed to begin or end of childs items list.

CtrlShiftA Insert Attribute

  Insert new XML attribute for selected XML element. Display dialog which allows the user to enter attribute name and value. Attribute name is checked for duplicity before inserting into attribute list.

CtrlShiftT Insert Text

  Insert new XML text item into tree. Display dialog which allows the user to enter contents text. New item becomes child of celected XML element. You may decide, if new item will be placed to begin or end of childs items list.

CtrlShiftD Insert CDATA

  Insert new XML CDATA item into tree. Display dialog which allows the user to enter contents text. New item becomes child of celected XML element. You may decide, if new item will be placed to begin or end of childs items list.

CtrlShiftC Insert Comment

  Insert new XML comment item into tree. Display dialog which allows the user to enter contents text. New item becomes child of celected XML element. You may decide, if new item will be placed to begin or end of childs items list.

CtrlShiftP XML Insert proc. instruction

  Insert new XML processing instruction into tree. Display dialog which allows the user to enter target and data.

### The Bookmarks Menu

CtrlB Bookmark Toggle bookmark

  This creates a marker in the document at the selected item. Bookmarked item path as added into Pathbar combo. User may traverse bookmarks using Previous or Next Bookmark command, or directly select bookmarked item in Pathbar combobox.

ShiftF5 Bookmark Previous bookmark

  Move selection to previous bookmark in document, relative to selected item. Bookmarked items, that are closed is skipped.

F5 Bookmark Next bookmark

  Move selection to next bookmark in document, relative to selected item. Bookmarked items, that are closed is skipped.

### The Settings Menu

Settings Show Toolbar

  When checked, this displays a movable toolbar containing buttons used to initiate frequently used commands. When unchecked the toolbar is hidden.

Settings Show Statusbar

  When checked, this displays a small bar at the bottom of the main window containing information about the status of the current document. When unchecked the statusbar is hidden.

Settings Configure Shortcuts

  This command opens a dialog box whereby the key bindings may be changed. A display window at the top of the dialog box shows the list of commands (actions) that can have keyboard shortcuts. Below the display are three radio buttons. The user may choose between No Key, Default Key, and Custom Key. (Note that a set of radio buttons only allows the selection of one of the offered items - in the way that buttons on a car radio only offer the selection of one preset station. Also, the Default Key selection is only available for those commands that actually have a 'default' shortcut.) Selecting the Custom Key option activates the three check boxes and key button at the bottom of the dialog. The user may then select a key combination for the command in question by means of the check boxes and key button. For example, with the About KDE command selected in the display window, the user could select Ctrl and Alt, click on the key button, and then press the K key on the keyboard. This would mean that anytime he or she held down the Ctrl and Alt buttons and pressed K (while using &kxmleditor;) the About KDE display box would be called.

Settings Configure Toolbars

  This will open the dialog whereby the toolbars configuration may be changed. The user can choose which shortcut buttons should appear on the toolbar. A display window on the left lists the commands available to placed on the toolbar. A display on the right lists those commands already on the toolbar. A set of four arrow buttons between the two displays manipulates the selections. The right pointing arrow places any command selected in the left pane onto the right pane, i.e., it is added to the toolbar. The left arrow does just the opposite, removing any action selected in the right window from the toolbar. The up and down pointing arrows change the position of an action selected in the right window which changes the position of its button in the toolbar.

Settings Configure &kxmleditor;

  This menu item opens a dialog whereby several different settings may be adjusted.

### The Help Menu

F1 Help Contents

  This invokes the KDE help system starting at the &kxmleditor; help pages (this document).

ShiftF1 Help What's This?

  This changes the mouse cursor to a combination arrow and question mark. Clicking on items within &kxmleditor; with this arrow will open a help window (if one exists for the particular item) explaining the item's function.

Help Report Bug

  This calls a dialog box to help the user help the KDE team to track down and solve any problems(bugs) in the program. The dialog attempts to do this by means of email using the information given by the user.

Help About KXML Editor

  This will display version and author information.

Help About KDE

  This displays the KDE version and other basic information.

## Configure &kxmleditor;

Selecting Settings Configure KXML Editor from the menu brings up the Configure-KXML Editor dialog box. This dialog can be used to alter application settings. By means of four buttons along the bottom of the box the user can control the process. She or he may invoke the Help system, accept the current settings pressing Apply button, accept the current settings and close the dialog by means of the OK button, or Cancel the process.

### Tree View

This category deals with following properties detailed below.

TarGz Extensions

Set root element decorated

  Set the root element in tree view decorated. Sets this view to show open/close sign on root item.

Default expand level

  Set the default expand level for tree view.

Enable drag & drop

  Enables or disables drag & drop. Disabling it may be useful, when X-Window client and server is not on the same machine and respond time is slow, that may cause unnecesary drag & drop operation caused while selecting in tree view.

Show...

  This option allow display XML attributes for each element in left side tree window. You may choose one of this options: Show only element name or Element, attribute name or Element, attributes names and its value.

### Defaults

This category allow set default XML version, encoding and program behavior while creating new document

Defaults

XML version

  Default XML version for new documents.

Encoding

  Default XML encoding for new documents.

Creating new files

  Behavior when creating new XML documents.

### Printout

This category allow set parameters for printing XML document

Printout

Font family

  Choose font family for printing document.

Font size

  Choose font size for printing document.

Element intendation

  Choose element intendation for printing document.

Print header

  Choose if you can print header when printing document.

Print footer

  Choose if you can print footer when printing document.

### TarGz Extensions

This category allow set list of XML files, that is TarGz archives. This allow open and save those files transparently. This may be useful for browsing KOffice files.

TarGz Extensions

Archive files extensions

  You may edit list of files extension using New and Delete buttons. Actually selected item may be changed using edit line.

### Text Editor

This category allow set text edior syntax highlighting

Text Editor

Syntax highlighting

  You may choose various colors for different XML syntax.

Element intendation

  Choose element intendation for raw XML editing. This intendation is used also for saving document.

Wrap, instead of Hrz. Scroll bar

  Disable horizontal srcrollbar and set word wrap ON for raw XML view and editing.

## Credits and License

&kxmleditor; Program copyright 2001-2003 the &kxmleditor; developers:

Lumir Vanek lvanek@users.sourceforge.net

  Developer and maintainer

Olaf Hartig hartig@users.sourceforge.net

  Developer

Adam Charytoniuk a_charytoniuk@users.sourceforge.net

  Developer

Documentation copyright 2003 Lumir Vanek lvanek@users.sourceforge.net

&underFDL;

&underGPL;

## Installation

### How to obtain KXML Editor

You may obtain &kxmleditor; from URL: http://sourceforge.net/projects/kxmleditor.

### Requirements

In order to successfully use &kxmleditor;, you need KDE 3.1.x or higher. For instructions on acquiring &kde; please see http://www.kde.org.

### Compilation and installation

In order to compile and install &kxmleditor; on your system, type the following in the base directory:

    % ./configure
    % make
    % make install

Since &kxmleditor; uses autoconf and automake you should have not trouble compiling it. Should you run into problems please report them to author.

&documentation.index;