Chapter 3: Simplicity of xmlDraft
xmlDraft is a proposed answer to the need raised above:
the ability to edit an XML Schema while seeing the what affects
these changes have on the instance XML document.
Below is an overview of the xmlDraft IDE.
- The text editor displaying the XML Schema. Editing directly here updates the tree.
- XML Tree View, showing an example of the instance XML document for this schema. Notice the dropdown at the top displaying ROLEMASTER. This particular schema can validate a couple different XML files, effectively all top-level xsd:element nodes.
- XML Properties window. The currently selected node in the XML Tree View is displayed here and all it's properties are listed for editing.
- XSD Message window, displaying any warnings and errors generated from parsing the XSD text.
See what you are defining
xmlDraft offers the unique ability of displaying a mock-up tree
representation of the XML document the schema is trying to define.
This mock-up is a single instance, empty representation of the XML document.
In other words, the tree view does not have multiple nodes of the
same name, just one.
XML Tree View
The basics of the Tree View is just that, a hierarchical view of the XML document.
As shown in the image to the side, you have a tree view representation
of what an instance XML document will look like. As hinted by the width
of the grid, not only are the elements and attributes represented, but
also all sorts of properties of that node (only Data Type is visible in
the current screen shot).
One Schema Defining Multiple XML Documents
xmlDraft offers an easy way to retain a pure view of the Instance
XML mock-up, and yet allow a way to show different documents, as many
as the schema defines. When a schema defines more than one document,
a drop-down will appear populated with the document element name of
each document. When the developer chooses a different document, the
treeview displays that document.
Node Properties Displayed In TreeView
In addition to the XML nodes being displayed inside the treeview,
the properties of the node is displayed as well. It's type, size,
occurrences, restrictions, etc.
Displayed here is the XML Tree View with as many columns as the
user sees fit to edit. When all properties of a node are visible, it can
be rather tedious and difficult to use, thus xmlDraft offers the ability
to customize which property nodes can be displayed. In the screenshot above,
the maxInclusive facet is being added to the grid.
Edit the definition or the instance
In addition to displaying the XML Document while you are editing the
XML Schema, xmlDraft offers the great and powerful ability to make
direct changes to the tree view and have the schema dynamically updated.
Changing the names of the nodes, adding and removing nodes, changing the
types, added restrictions such as enumerations and ranges, updating
documentation, and even moving nodes around are all allowed in the tree
view and fully supported, making the necessary changes to the schema text.
Any change made in the text will automatically update the XML Tree View.
And visa versa, changes made to the XML Tree View will automatically
update the XSD Text. Shown above, the Type attribute is
being changed of an element. The text is directly updated.
xmlDraft removes the potential complexity of XML Schemas, both in
understanding the XML Schema itself, as well as in understanding how
the XML Document for this schema should look like. xmlDraft can
even reduce the learning curve of schemas. In fact, you could work
entirely in the XML tree view and never have to touch the schema,
completely abstracting the details of schemas for a later time.