VisualDTD

UltraXML contains a full-integrated DTD editor, allowing users to quickly create or edit an XML DTD that conforms to the World Wide Consortiums definition. A DTD is a grammar that describes the legal syntax of an XML document and can be used to validate an XML document.

In addition to DTD editing and creation, VisualDTD tracks the current position in the XML stream being editing and displays both a tree of valid elements that can follow the current XML tag and a tree of attributes for the current element.

VisualDTD also presents the user with right click menus of valid elements to assist in XML markup. Only XML elements that are valid for the current position in the XML stream are displayed. By doing this, it makes it easier to create or markup text with valid XML tags from the outset, rather than looking for validation errors later.

The VisualDTD Tree

Clicking on the DTD Tab in the XML Workspace window you will display the DTD tree and editor window. This window will display the DTD tree for the current XML element.

When the cursor is moved in the XML stream, the current XML element is displayed in the DTD tree. The tree then gives the user an instant snap shot view of what XML elements are valid from this point in the XML. It also gives the user a list of valid attributes and their values. The DTD attribute window also shows which attributes values are defaults and which attributes are required.

Example DTD tree and the VisualDTD interface:

>The tree on the left shows a view of a simple DTD for a catalog of products.

The tree is read as follows:

A CATALOG must have a child element called PRODUCT, which in turn can have up to four child elements, SPECIFICATIONS, OPTIONS, PRICE and NOTES. These four child elements must be in the order shown. SPECIFICATIONS and PRICE are compulsory elements, but OPTIONS and NOTES are optional.

You will notice a drop down list at the top of the tree. This is a list of all elements that exist in the DTD. The element shown in the list is the current DTD element, and the one that can currently be edited.

Above the list is a series of four buttons. The function of each button is described below.

From right-to-left the DTD buttons work as follows:

*                         Toggles the Attribute editor window on / off.

*                         Toggles the Entity editor window on / off. 

*                         Edit DTD source code in Code Editor Window.

*                         Generate a DTD from the current XML stream.

The screenshots below show the result of toggling the attribute and entity windows.

Attribute Editor Window

Entity Editor Window

In order to create or edit a DTD you must right click in the DTD workspace window. Upon doing so, a context menu will appear, presenting various creation and editing options.

Clicking on an empty workspace will ask for a new element. This is the starting point for creating a new DTD. Once the element name has been entered, a new DTD stream will be created and activated. Activating a DTD causes it to become the default DTD for the document.

Once an element exists in the DTD it is then possible to insert child and sibling lists and elements to the DTD schema. There are four types of list and elements. These are Standard, Optional, Compulsory and Repeatable. Lists can also be ‘Ordered’ or ‘One from’.

Before describing the terminology of each of these list and element types, it is important to point out how to structure a DTD as a combination of lists and elements.

There is really just one simple rule:
If an element is to have a definition then that element must be followed by a list. This list can then have a number of child elements and a number of child lists.

DTD editor terminology

Element                       This is an XML element name

Standard                      A simple element or list, which has no qualifiers such as optional, compulsory etc.

Optional                      An optional element or list, does not have to appear in the XML

Compulsory                 A compulsory element or list, must appear in the XML

Repeatable                  A repeatable element or list can appear any amount of times including none.

One from List              This is a list from which only one of the child elements needs to appear in the XML to be valid.

Ordered List                This is a list from which all child elements should appear in the order of the list, in order to be valid XML.

 

Below are some screenshots of the context menus, showing the terminology described above.

The menus below appear when right clicking on an element in the DTD tree. This allows you to insert a new node, select the element for more focused editing, or deleting the element. Selecting an element rebuilds the DTD tree for just that element. This is useful for large DTDs with many elements, so that only the relative section of the DTD is shown for editing.

 

   

 

The following menu appears when right clicking on an Optional / Compulsory or Repeatable node in the DTD tree. This allows you to insert a new node or to change the type of the node to optional, compulsory or repeatable. It also allows you to delete the node.

 

 

The menu below appears when right clicking on a list node in the DTD tree. Again this allows you to insert a new node and also allows you to change the type of the list between Ordered or ‘One From’.

DTD tracking and markup

So far we have shown how to create or edit a DTD and how to add attributes to the DTD elements. Now lets looks at how we can utilize the DTD to assist with the XML markup.

Right clicking on the Code Editor window will display a menu of elements that are children on the parent element of the current position in the XML text stream.

For example, if the cursor is somewhere inside the <PRODUCT> tag, then only tags which are children of the <PRODUCT> tag, according to the active DTD, are displayed.

You will notice that an ICON sometimes appears alongside the element name. These are to aid in the correct choice for tagging or marking up the DTD. A + icon specifies the element is compulsory, and a ? Icon specifies that the element is optional and a * icon specifies the element is repeatable.

Selecting an element from the menu will insert the start and end tag for that element and position the cursor between them.

Selecting an element from the menu when there is selected text, will insert the start and end tags around the selected text and move the cursor after the end tag for the element. This is useful for marking words and phrases and XML text, which is valid according to the active DTD.

Also, the DTD editor automatically tracks the position in the XML text stream and displays the DTD tree for the current element.

Of course, DTDs that are generated visually can be used just like any other DTD. They may be used for validating the XML text as usual and they may also be exported and used in other 3rd party XML systems

 

Home | Contact | Profile | Markets | Privacy Statement
Become a Reseller | Partners | News & Events
UltraXML |UltraXML Server | UltraXML ActiveX Control | UltraXML Author |S1000D Publication Manager
UltraCSDB S1000D CSDB |  Data Conversion | Consultancy
FAQs | Download | Search