TagBar is a tool that lets you quickly compose an XML document based on an XML Schema. TagBar displays the Schema definition as an expandable element tree. This tree shows all the elements defined in the Schema, their relationships and attributes.
To get started with TagBar, use the Load TagBar command in the Tools menu to load a Schema document into TagBar. The root of the TagBar tree is the root element as defined in the loaded Schema. The children of an element in TagBar are the element’s attributes, the allowable child elements for that element, and any user defined content nodes.
Each element represented in TagBar has an associated icon. The meanings of the icons are explained below:
![]() |
A sequence of this element may appear. The order of the sequence matches the order shown in TagBar. |
![]() |
Only one of this element may appear. |
![]() |
Multiples (Many) of this element may appear in any order. |
Additionally, the following icons represent attributes and content nodes:
![]() |
An attribute of the parent element. |
![]() |
A user defined content node. |
The minimum and maximum allowable number of each element is shown in the square [] brackets following the element name. The first number in the square brackets indicates the minimum allowable number of this element. The second number in the square brackets indicates the maximum allowable number of this element. An asterix (*) indicates that there is no limit on the maximum number of instances of the element.
The Schema datatypes as defined in the XML schema can also be displayed after the minimum and maximum values. The Show Datatypes in TagBar preference must be enabled to see datatypes. This preference is disabled by default.
To insert an element into the current document using TagBar, click and drag the element you wish to insert. Drop the element in the location where you want to insert the element.
One of the most convenient features of TagBar is the ability to specify child elements, attributes and content that should be inserted when a given element is inserted.
The Auto Insert functionality is controlled at both a global and local level. There is a global preference called TagBar insert mode, which controls the overall behaviour of TagBar. This preference is accessible from the Preferences dialogue box, or by right clicking on a tree item in TagBar. The values that this preference may have are:
Don’t Insert Children | Only the specific element dragged from TagBar will be inserted. No attributes, child elements, or content nodes will be inserted. |
Auto Insert Children | Only the attributes, child elements, and content nodes that are switched to Auto Insert will be inserted. See below for further explanation. |
Insert All Children | All attributes, child elements, and content nodes will be inserted. |
At a local level, you can individually specify which elements, attributes and content nodes should be automatically inserted. To switch an element on or off Auto Insert, right click on the element and select Auto Insert. Elements that are set for Auto Insert are displayed in bold in the TagBar tree.
Content nodes allow you to define common or repeatedly used content for a particular element. To define a content node for an element or attribute, right-click on the tree item and select Add Content Node. After you type some text and press OK, a new child node will be created for the element or attribute you selected. If this content node is on Auto Insert, when you drag the parent element or attribute into the document the content will be placed inside the element’s start and end tags, or as the attribute value respectively.
You can define multiple content nodes for an element or attribute and include some or all of them by setting the Auto Insert properties of each.
You can also drag content nodes directly into the document, just inserting the text itself without an element or attribute.
If you are working with a very large Schema, it may be convenient to only display some portions of the Schema in TagBar. You can hide individual elements, attributes and content nodes in order to reduce clutter in TagBar. You hide a TagBar item by right clicking on the item and selecting Hide. You can show hidden items by clicking on the item’s parent and selecting the item from the Show Children list. Note that you cannot hide the root element.
Hidden items are still inserted if the global preference and the Auto Insert value for that item dictate that it should be inserted. This is convenient if you have a lot of standard elements that you still want to insert, but don’t need to see in TagBar.
When you load a schema, default values for attributes are automatically inserted as content nodes for that attribute. Attributes indicated as required in the Schema are initially set to Auto Insert.
You cannot save your changes to TagBar in this Beta version of XMLwriter. In the release version you will be able to save your content nodes and Auto Insert settings.