This tutorial teaches you the main functions of the XML Assistant using concrete examples.
Files are opened using the menu item File->Open or the icon in the toolbar.
For this tutorial we open the example file using the predefined menu item Help->Example "Internet Pages".
The following figure shows the file opened in the XML Assistant. The application window is divided into: 1) View of the XML file as tree of nodes 2) Namespaces, attributes and elements of the tree node selected 3) View of the XML Code.
Display rules define how the data of a XML file is shown. For different types of XML files different rule sets can be created.
The rule set "WebPages" is already selected in the list of rule sets. The rules defined there are applied to the file, they define icons and text of the tree (left) and the input fields for the element selected (right).
Lets modify the rules of the rule set to better understand how it works.
Please select 'Edit Display Rules' from the toolbar:
The tab "Display Rules" is opened:
For a clearer view we minimize the XML code view and position the tab 'Display Rules' at the bottom.
As the next step we move the tab 'Display Rules' to the bottom of the main window. This is done by clicking on the tab title and dragging it to the bottom forth of the main window. The mouse cursor is changing during the drag operation.
The tab is rearranged:
Now we edit the display rules, we open the rule set "WebPages" and the rule "Web Page". On selection of "Condition: Page" or "Conditions Match" we can, for example, see that the text "Page: http://www.myspace.com (05)" may be shown for a tree node that represents the element "Page". Multiple "Page" elements are shown in the tree.
Now change the input for "Node Text in Tree" to '$name: [Title] ([@id])'. The changes are directly applied while you are typing. The text encoded in square brackets is not simple text but expresses a XPath-Expression to be executed on this element. In this example the title is shown instead of the URL.
As you can see in the existing rule sets, many more configuration possibilities are available. Please take a few seconds to try them.
Templates are used to add frequently used code passages quickly. This may prevent the need for frequent copy/paste operations.
For demonstration we again use the file "Internet Pages".
Doing a right click on the root node will open the context menu. In the sub menu "New" you can already see a template, that has been defined to be listed here.
For creation of a new template we select "Responsible" and choose "As New Template" from its context menu.
A template is simply an own XML file whose content is made available over the context menu. Templates are edited and saved like ordinary XML files. They are saved in the 'templates' subdirectory of the User Configuration Directory (Reachable with: Help->Info/License->"Browse: User Configuration Directory").
In this example we remove all content of the template nodes, this is done by selecting the root node and the context menu item Edit->Remove Contents.
The template must also be made available to the nodes that use the template. For this, open the rule set "WebPages" and the rule "Web Page", the sub item "Templates in Context Menu" of "Conditions Match" defines, which templates are to be listed in the context menu for nodes matching this rule. We add the new template.
The template will be shown in the context menu list now.
Describes the main features for editing XML in XML Assistant.
The most important edit features are accessed using the context menu (right mouse click) of the XML tree nodes or the menu Edit in the main menu:
The main features are:
Namespaces are managed similarly to attributes and content. To add a namespaces, use the menu entry 'Add Namespace' (also available in main menu 'Edit'):
Add prefix and URI in the input dialog, e.g.:
After confirmation with 'Ok' the new namespace is added:
Using the context menu of the namespace shown, you can delete and edit the namespace:
For editing in the right area you can use the following shortcuts on your keyboard:
The comfort of editing XML files considerable depends on the rules being used. Using an example file this chapter will show, which view rules the XML Assistant provides.
Preparation of the example
First we open the needed tabs, to do this, choose Help>Example "Internet Pages" from the main menu.
Now choose 'Edit Display Rules'.
The tab for editing the rule sets is opened. As shown below it is more comfortable to move the tab for editing rules to the bottom of the window. For this, drag the tab title with left mouse button hold down to the bottom of the main window.
To finish the preparation please minimize the XML code. We will not need it.
Rules and rule sets
Rules are grouped in rule sets. For the example file there already exists the rule set "WebPages". Every rule set may contain multiple rules.
Conditions and display options of rules
Rules do contain one or more conditions (in most cases one condition is sufficient) and many display options. If all of the conditions (1) are met for a node, the display options (2) are applied.
In this example the condition "Name is... Page" is sufficient. It means that if an elements in the tree has this name, the display options are applied. The other types of conditions are described on the page for editing a condition.
If all conditions match, the display options under "Conditions Match" (1) are applied. The options affect the tree (2: left) and the input panel (3: right).
Overview over the display options
The display options are separated into different categories. These categories are:
Please take some time to make you familiar with the display options.
The XML Assistant hides as much as possible of XML files. Doing this it enables you to concentrate on the contents. But in some cases you would like to also show elements with attributes or sub elements in the edit panel (right). This may be needed to e.g. change the order of the elements. To do this, please activate the option "Also Show Elements With Attributes/Children".
This will result in also these elements being listed.
By pressing the CTRL key and moving the cursor over a field that represents an element with children the mouse cursor changes. Doing a right click will jump to this element.
The same can be achieved by holding down the ALT key and click left
By clicking with the left mouse button when CTRL is down, the entry clicked is added to the selection.
To move content, click on it or select it, then hold down CTRL and move the mouse wheel up or down.
This documentation covers the major functions of XML Assistant, but not all.
We hope you enjoy using our software.