| XAmple
XML Editor 2.2 Demo Short User Manual |
|
On This page - with a click at the "get XML" button you
can retrieve XML document from the XML editor and put it into the text area.
You may want to edit it in the text area and put it back into the XML editor
with the "load XML" button click. |
| a). Tree View:
Editor mode and Viewer mode. |
| The XML editor exposes 2 tree views panels, which reside
on a split-pane. The width of the left view initially is minimized and the
right view covers the whole area. Each view can be set to Editor/Viewer
modes (by pressing Editor/Viewer buttons on the view toolbar). A tree view
in the Editor mode exposes a hybrid of XML Document and Schema, whereas
a tree view in the Viewer mode exposes a real structure of the XML document.
Initially the left view is set to the Viewer and the right one - to the
Editor mode. Optionally, a user can synchronize navigation through nodes
of the tree views (by pressing "Synchronized" button on the main toolbar).
When navigation is synchronized, a user can add, remove or edit elements
in Editor tree view and immediately see changes on Viewer. When navigation
is not synchronized, a user can search a document for certain element/attribute
values in one view, maintaining at the same time current position on another
view. |
| b). XML tree - folders and
leaves. |
| A tree, which represents XML document consists
from folders (tree nodes with child nodes) and leaf nodes. Each folder
is provided with an "expansion-bar" - a narrow vertical button, which is
located along its left border. A folder can be expanded/collapsed with a
mouse click at its expansion-bar. When mouse pointer enters an expansion bar, the
XML editor displays respective folder information in a special area. |
| c). Insertion and removal
of elements/groups with multiple occurences. |
| A tree view in the Editor mode exposes a special
type of folders - "array-folders", which contain multiple occurrences
of element and group instances. These folders are marked "Array (...)
of ..."; their expansion-bars are painted to blue. The XML
editor allows insertion and removal of the tree nodes within array-folders
only. To insert an element or group node in array-folder, you
have to select any existing node within the array-folder and click "Insert
before..." or "Insert after..." button or choose a respective item from
the pop-up menu. A selected node within an array-folder can be removed
with "Remove node" button click.The editor doesn't allow to remove the last
node from an array-folder. If Schema-specified "minOccurs" of the
respective node is 0, then the whole array-folder can be disabled by
unselecting its toggle control (check-box or radio-button - see (e)).
|
| d). Changing an order of element
and group instances. |
| A tree view in the Editor mode allows changing
an order of elements and groups within "array-folders" (see (c))
and elements - members of "xsd:all" groups (marked as "Reorderable Group").
To change an order of elements or groups you have to select a respective
element/group node and click "Move up" or "Move down" button (or select a
respective item from the pop-up menu). |
| e). Adding and removal of
optional elements and attributes. |
| All the tree nodes on a view in the Editor mode,
excluding immediate children of array-folders are provided with
toggle controls (check-boxes/radio-buttons).
The toggle controls are permanently selected
and disabled for the mandatory nodes and enabled for the optional
ones. Unselection of the toggle control disables respective node
and all its descendants. Disabled (grayed out) nodes are not
included in the resulting XML document and are not shown by a tree
wiew in the Viewer mode. |
| f). Choice groups and element
substitution groups. |
| Choice and substituion group nodes are shown only
by a tree view in the Editor mode. If a choice group contains neither other
groups nor elements with substitution groups, then such a group is
represented with a node, which is provided with a drop-down list of
available child elements. In this case only one (currently selected)
branch is visible at the time. Otherwise all the child nodes of the
choice group node are provided with radio-buttons, which constitute
an exclusive child selection. An elements with a substitution group is always
represented with a node, provided with a drop-down list of substitution
elements. |
| g). Input validation. |
| The editor verifies validity of element and attribute
text values just in time of typing and displays respective error messages.
The validity is checked against type, enumeration, minimum and maximum
length, regular expression pattern, ID-IDREF referential integrity,
etc. All the invalid tree nodes change their colors to red and propagate
"invalid" status to their parents - up to the tree root. Any new
element node, which can contain other elements appears at first as collapsed
and marked as invalid. To make it valid a user has to expand it (and
possibly edit values of its children). To find nodes with invalid text
values a user may click "Find Invalid Node" button or choose respective
item from the pop-up menu. |
Currently there are following groups of examples available for the XML editor demo applet:
The Divisions and Wild-xsd-groups examples are my own quite arbitrary but representative ones. All the others represent real configuration examples from the different sources. Currently different examples demonstrate different features of the XML Editor. Here is the list of the XML Editor features and respective examples to look at.
A web-page which holds the applet can be generated by a servlet, which writes the applet parameters (XML_SCHEMA, XML_SOURCE, XML_DEST, etc). Alternatively, the applet methods can be called by the javascript code. The XML_DEST parameter (and respectable property with get/set methods) specifies the URL of a servlet (with a query string) to which the applet posts the edited version of the XML document. Since there is no such servlet in this demo, the "Save XML Document" button does nothing.
For more details about the XML editor you can read the full user-manual document.