XML Schema Editor Tree Tab

To display the XML Schema editor, open an XML Schema document, or select File > New > XML Schema from the Stylus Studio menu bar. At the bottom of the XML Schema editor window, click the Tree tab.

The Tree tab displays a DOM tree representation of the schema. To expand a tree so that you can see all the nodes in the tree, click the root node and then press the asterisk ( *) key in the numeric key pad. To expand any particular node, click that node and press * in the numeric key pad.

When you display the Tree tab, Stylus Studio also displays the Properties window. You can edit the list of properties or the tree. Any changes you make in one window are immediately reflected in the other window.

Fields

Properties

The Properties window displays the properties for the selected DOM tree node. Click a node in the DOM tree to view its properties. The properties that appear vary according to the type of node you select. See About XML Schema Properties.

To edit properties in the Properties window, double-click the value you want to change. For some properties, Stylus Studio displays a shortcut menu of possible values. Double-click the value you want. For other properties, you must type the new value, and press Enter.

Buttons for Editing

Refresh the tree display.

Delete the selected node.

Change the name of the selected node.

Change the value of the selected node.

Move the selected node up.

Move the selected node down.

Toggle the display of white space.

Validate the XML Schema document.

Change the font used to display text in the XML Schema editor.

Open Schema opens the schema, if there is one, for the XML document.

Buttons for Adding Nodes

Table 171 describes the buttons in the left tool bar of the Tree tab. These buttons allow you to define elements, attributes, model groups, attribute groups, complex types, simple types, and documentation.

Button
Description of New Node
New Element Definition
Click the Schema node or a model group node ( all, any, choice, or sequence) and then click this button to define a new element as a child of the selected node.
New Attribute Definition
Click the Schema node, a complex type node, or an attribute group node, and then click this button to define an attribute name. This attribute is associated with the node that was selected when you clicked New Attribute.
New Group
Click the Schema node, a complex type node, or a model group node, and then click this button to define a new model group. The group can contain new definitions of elements, references to previously defined elements, nested definitions of groups of elements, or references to groups of elements.
New Attribute Group
Click the Schema node or a complex type node, and then click this button to define a new attribute group. The group can contain new definitions of attributes, references to previously defined attributes, definitions of new attribute groups, or references to attribute groups.
New Model Group
Click a complex type node or a group node, and then click this button to specify a model group. A model group specifies the occurrence rules for the elements that you add as children of the model group node. Specify one of the following values:
l all specifies that each element must appear exactly zero or one time. The elements can appear in any order. In an instance document, the children of the group or complex type can include 0 or 1 instance of each element.
l choice specifies that exactly one element can be present, and there must be only one instance of that element. In an instance document, exactly one element can be a child of the group or complex type.
l sequence specifies there must be exactly one instance of each element and the elements must appear in the order in which they are specified in the schema. In an instance document, each element must appear once. They must have the same order they have in the schema.
Another value you can specify is any. When you specify any, you do not add any element definitions or references to elements. As the name implies, any element can appear any number of times.
New Simple Type
Click the Schema node, an element node, an attribute node, a list node, or a union node, and then click this button to define a simple type. An element that contains only data is a simple type. Attributes are always simple types.
New Complex Type
Click the Schema node or an element node, and then click this button to define a complex type. An element that contains anything more than raw data is a complex type.
New Restriction
Click a simple type node and then click this button to specify the base type for the simple type.
New Extension
Click a content node and then click this button to specify the base type that this complex type extends.
New Content
Click a complex type node and then click this button to specify simpleContent or complexContent. Specify simpleContent if the type contains only text. Otherwise, specify complexContent.
New Aggregator
Click a simple type node and then click this button to specify list or union. A list aggregator indicates that the contents of the simple type must all be of the same type. A union aggregator indicates that the contents of the simple type can be of different types.
New Facet
Click a restriction node and then click this button to specify a facet that narrows the allowable set of values for the simple type.
New Notation
Click the Schema node and then click this button to define an unparsed entity.
New Include
Click the Schema node and then click this button to include another XML Schema in this XML Schema. The included schema augments the including schema. Both schemas must have the same target namespace.
New Import
Click the Schema node and then click this button to import another XML Schema into this XML Schema. The importing schema can reference the imported schema. The two schemas must have different target namespaces.
New Redefine
Click the Schema node and then click this button to include another XML Schema but with some redefinitions. A Redefine node is a variation of an Include node.
New Identity Constraint
Click an element node and then click this button to define an identity constraint. The type of an identity constraint is unique, key, or keyref.
New Selector/Key
Click an identity constraint node and then click this button to define the selector or key for the identity constraint.
New Reference to Element
Click a model group node ( all, any, choice or sequence), and then click this button to specify an element that the parent element of the model group node can contain.
New Reference to Attribute
Click a complex type node, and then click this button to add a reference to an attribute.
New Reference to Group
Click a complex type node or a model group node ( all, any, choice, sequence), and then click this button to add a reference to a group.
New Reference to Attribute Group
Click a complex type node or an attribute group node, and then click this button to add a reference to an attribute group.
New Annotation
Click any node to add an annotation node. An annotation node indicates the beginning of some documentation.
New Documentation
Click an annotation node to add documentation. You can include text, a URL, a file path.
New Text
Click a documentation node to add a text node.
New Comment
Click any node to add a comment node.
Table 171. Tree Tab Button Descriptions

For More Information

Creating an XML Schema in Stylus Studio

What Is an XML Schema?

Defining simpleTypes in XML Schemas

Defining complexTypes in XML Schemas

Defining Elements and Attributes in XML Schemas

Defining Groups of Elements and Attributes in XML Schemas

Adding Comments, Annotation, and Documentation Nodes to XML Schemas

 
Free Stylus Studio XML Training:
W3C Member