Editing Tools of the Diagram Tab

Many of the operations you perform in the Diagram tab can be performed in a number of ways, menus and tool bars being the most common. This section briefly describes menu and tool bar use, and introduces two additional features, for defining XML Schema - drag-and-drop and QuickEdit.

Tip

 

Once you create a node, you describe it by editing its properties in the Properties window.

Menus and Tool Bars

The complete set of available operations is defined by the menu system. The tool bar represents a subset of menu operations. The top-level menu ( XMLSchema > Diagram), the shortcut menus, and the tool bar are context sensitive - only operations that are permitted given the current context are available. For example, if you want to add an element to a sequence, you can

  • Select XML Schema > Diagram > Add > Element from the main menu
  • Select Add > Element from the sequence shortcut menu
  • Click the Add button on the tool bar and select Element from the drop-down list it displays

Each of these actions let you add a new node, in this case, an element, to your XML Schema definition.

Drag-and-Drop

An alternative to using the menu and the tool bar is to use drag-and-drop, which lets you add an existing node to another node's definition. For example, say you wanted to add an existing element to a sequence. You can do this by dragging the element icon to the sequence icon, as shown in Figure 73.

Figure 73. Using Drag-and-Drop to Define a Node

Use drag-and-drop any time you want to define a node using a node already defined in your XML Schema.

Tip

 

When you drag and drop, you remove the element from its current context. If you want to make a copy an element, press and hold the CTRL key when you perform the drag operation.

Typical targets of drag-and-drop operations include the following nodes

  • schema
  • sequence
  • choice
  • all
  • list
  • annotation
  • restriction
  • union

Typical sources for drag-and-drop operations include the following nodes

  • simpleType
  • element
  • annotation

Tip

 

Any node you drag to the schema node is created as a child of the schema node.

QuickEdit

QuickEdit is a feature of the Diagram tab that streamlines common editing operations. For example, you can use QuickEdit to

  • Change a sequence to a choice or to an all
  • Specify a restriction for a simpleType
  • Create sequence, choice, any, and all element definitions

For example, the following structure was created by selecting QuickEdit > Add Elements Choice from the complexType's shortcut menu.

Figure 74. QuickEdit Creates Complex Definitions With a Click

QuickEdit appears on the top-level and shortcut menus in those contexts in which it is available, and it is also available on the tool bar by pressing the QuickEdit button .

 
Free Stylus Studio XML Training: