xample_logo.gif (2517 bytes)
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.
On the page in the frame below -
you can click at the listed there links in order to load new XML documents from the server to the XML editor.

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:

  1. Divisions,
  2. Wild-xsd-groups.
  3. Ejb-jar,
  4. Jnlp,
  5. Log4j,
  6. TagLibrary,
  7. Xmldbms.

      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.

  1. Additional labeling of the elements/groups with information, taken from their descendants – in Divisions, Log4j, Jnlp, Ejb-jar_1_1, Xmldbms. 
  2. Multiple namespaces support – in Divisions. Divisions.xsd schema document uses Types.xsd schema document, which defines its own namespace.
  3. Custom field editors, declared within "appinfo" elements of the schema document – in Divisions, TagLibrary, Xmldbms. All the field editing check-boxes, editable combo-boxes and text area dialogs in these examples are custom editors.
  4. ID-IDREF referential integrity control – in Log4j. The application provides drop-down lists of available ID values for editing of the IDREF values.
  5. Messages for selected nodes - Divisions, TagLibrary. In “Divisions” example messages are defined for the "Division" elements (in both element and type definitions) and {Supervisor or Employee}/ChoiceGroup/SequenceGroup #2/ContractStartDate-ContractEndDate elements. In the “TagLibrary” example messages saying "Fully qualified class name" are defined for "validator-class", "listener-class", "tag-class" and "tei-class" fields. You can easily insert your own messages into “documentation” schema elements for any element, attribute and type definitions.
  6. Regular expressions control during typing - Divisions, TagLibrary. In the “Divisions” example try to edit {Superviser or Employee}/EmployeeInfo/SSN fields. In the “TagLibrary” example try to edit any "*-class" field.
  7. Nested grouping - Divisions (choice groups within "Supervisor" and "Employee" elements contain sequence groups). Since these choice groups contain other groups, they are represented with radio-groups. All the other choice groups in all the examples contain elements and therefore they are represented with drop-down lists.
  8. Substitution group - Division ({Supervisor or Employee}/array of < File > elements).
  9. Schema "all" Group - Divisions. It is labeled "Reorderable Group" and resides within {Supervisor or Employee}/EmployeeInfo/EContact elements.
  10. elementFormDefault="unqualified" - Log4j, elementFormDefault="qualified" – all other examples.
  11. Search for invalid nodes - Divisions - Divisions_BAD.xml. This xml file contains 3 errors. Try to load it and click "Find invalid node" button. After each button click the editor shows next invalid node found.
  12. NEW! Wild-xsd-groups example demonstrates a new ability of the XAmple XML editor v2.2 to resolve correctly non-trivial combinatorial problems of reconstruction of hierarchies of xsd:sequence and xsd:choice groups for given sequences of child xml elements.

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.