XML Schema Tools: Exploring XML Schemas
Last Updated: 19 October 2006
Back to Getting Started With XML Schema Tools
The goal of this tutorial is to explore the sample XML schema that you opened in the previous tutorial, Opening a Sample XML Schema, using the Schema view of the XML schema editor and the Schema View of the Navigator window. You will also use the Find functionality available in the Schema view.
Note: Wherever you see the
icon, you can click to view a detailed interactive demonstration of the steps described in the tutorial.
top
About the Schema View
After completing the steps in Opening a Sample XML Schema, the Projects window shows a node for your mySchemaPrj project and the sample XML schema is open in the Schema view of the XML schema editor.
The Schema view allows you to visualize and edit an XML schema in a scalable fashion. The Schema view is the view that opens in the Source Editor when you first double-click a schema file (.xsd) node in the Projects window.

The Schema view has the following parts:
- Editor toolbar. The Editor toolbar is located at the top of the view, just below the tab for the XML schema file. The Editor toolbar has the following buttons:
- Navigation buttons. The Source, Schema, and Design buttons let you switch to those views of the XML schema.
- View buttons: Column button
and tree button
.
The Schema view has two subviews: the column view and the tree view of schema components. The column view is the default view. To switch between the column and tree views, use the column and tree buttons in the editor toolbar.
- Validate XML button:
Use this button to validate the XML in your schema.
- Breadcrumb area. This area appears immediately below the Editor toolbar when you are using the columns view of the Schema view. This area allows you to retrace your steps by clicking a breadcrumb. The first entry in this area is always labeled "Schema" for the root of the schema.
If the entries extend beyond the visible area, the IDE enables the scroll buttons so that you can continue to navigate through the breadcrumbs.
- Schema content area. This area contains the column view or the tree view of the XML schema. The nodes in both views let you drill down into the schema. Each folder node represents slices of the schema, such as attributes, complex types, and elements.
- Column view. In this view, the Schema content area initially contains one column. Each time you select a node that has children, another column is added to the right of the column where you made your selection. The nodes that have child nodes are indicated by a black arrow next to the node in the column. If a node has no child nodes, that arrow is light gray.
- Tree view. In this view, the Schema content area contains one tree view of the XML schema. You can drill down on schema components by expanding the nodes.
- Find bar. Use this bar to quickly find components in a schema. You can use the Find Next and Find Previous buttons to cycle through matching components. See Using Find for details.
top
Exploring the XML Schema in the Schema View
To explore the XML schema in the column view of the Schema view:
- If mySchemaPrj is not open in the IDE, open it now and then open the newLoanApplication schema file.
- In the Schema view, click the column button
to make sure you are in the column mode of the view.
- Maximize the view by right-clicking the tab for the file and choosing Maximize Window from the pop-up menu.
Maximizing the view lets you see more information about the shema in the column view of the Schema view.
- In the first column of the Schema view, select the Elements node, and then in the second column, select the autoLoanApplication node.
The IDE adds a new column to the right of the column where you selected the node. This new column shows you the detail of the node you selected.
- In the column that shows the detail of autoLoanApplication, select the complexType node, and then in the next column, select the sequence node.
- In the column that shows the detail of the sequence, select the tradeIn node.
The IDE adds another column to the right of the last column. This new column shows you the detail of the node you selected, tradeIn.
- Continue drilling down on the element definition by clicking nodes in the last column of the Schema view.
Remember that you can use the links in the breadcrumb area at any time to retrace your steps.
View Demo
To explore the XML schema in the tree view of the Schema view:
- If mySchemaPrj is not open in the IDE, open it now and then open the newLoanApplication schema file.
- In the Schema view, click the tree button
to make sure you are in the tree mode of the view.
- In the Schema view, expand the Elements node, then expand the autoLoanApplication node.
Each time you expand a node, the IDE shows you that node's contents.
- Continue expanding child nodes to see their content.
View Demo
top
Using the XML Schema View of the Navigator Window
The Navigator window provides a compact view of the currently selected file and simplifies navigation between different parts of the file. For XML schema files, the Navigator has three views: Design, Schema, and XML. In this topic, you will explore the Schema View of the Navigator window. The Schema View of the Navigator window shows a tree similar to the one in the tree view of the Schema view of the XML schema editor.
You can use different techniques to navigate directly to schema components from the Navigator window.
Before you continue:
- If mySchemaPrj is not open in the IDE, open it now and then open the newLoanApplication schema file.
- In the Schema view, click the column button
to make sure you are in the column mode of the view.
- If the Navigator window is not visible in the IDE, choose Window > Navigator.
The following illustration shows the Schema view of the Navigator window and the Schema view of the XML schema editor.

To navigate from the Schema View of the Navigator window to the Schema view in the XML schema editor:
- In the Navigator window, from the view drop-down list, select Schema View.
- In the Schema View of the Navigator window, expand the Complex Types node.
- Do one of the following:
- Select and right-click the ApplicantType node and choose Go To > Schema.
- Double-click the ApplicantType node.
- Select the ApplicantType node and press Enter.
The Schema view of the XML schema editor becomes the active view and the ApplicantType schema component you selected in the Navigator window is the current selection in the second column of the Schema view.
View Demo
To navigate from the Design View of the Navigator window to the Schema view in the XML schema editor:
- In the Schema view of the XML schema editor, click the Design or Source button to switch to that view of the schema.
- In the Navigator window, from the view drop-down list, select Design View.
- In the Design View of the Navigator window, select and right-click the AddressType node and choose Go To > Schema.
The Schema view of the XML schema editor becomes the active view and the AddressType schema component you selected in the Navigator window is the current selection in the second column of the Schema view.
View Demo
top
Using Find
You can use Find functionality in the Schema view to quickly find components of a schema.
To find components by matching name:
- If mySchemaPrj is not open in the IDE, open it now and then open the newLoanApplication schema file.
- Maximize the view by right-clicking the tab for the file and choosing Maximize Window from the pop-up menu.
Maximizing the view lets you see more information about the shema in the column view of the Schema view.
- In the Schema view, click the column button
to make sure you are in the column mode of the view.
- From the IDE main menu, choose Edit > Find.
You can also press Ctrl-F.
- In the Find box, click the magnifying glass icon
and select Component Name from the list.
In this case, the IDE will look for components whose name attribute matches the string you enter in the Find box.
- Click in the Find box, type residence, and press Enter.
The IDE selects the first matching occurrence (as it appears in the source) of residence.
All the named components whose name contains residence as a substring, without case matching, are highlighted in light orange. Since this is not a usage search, components that reference the residence component may or may not be highlighted, depending on their names.
- Click the Find Next and Find Previous buttons in the Find bar to cycle through matching occurrences.
- Reset the find criteria by clicking the Clear button in the Find bar.
View Demo
To find components by matching attributes:
- Click the magnifying glass icon in the Find box,
and select Attribute Declaration from the list.
In this case, the IDE will look for components with attributes that match the string you enter in the Find box.
- Click in the Find box, type minoccur, and press Enter.
The IDE selects the first matching occurrence (as it appears in the source).
- In the Schema view, right-click the selection (tradeIn) and choose Go To > Source.
The IDE switches to the Source view and the cursor is positioned at the following line:
<xs:element name="tradeIn" minOccurs="0">
because the string minOccurs matches your find criteria.
- In the Source view, with the cursor in the <xs:element name="tradeIn" minOccurs="0"> line, right-click and choose Go To > Schema.
The IDE switches back to the Schema view, where the Find results are still highlighted.
- Click the Find Next and Find Previous buttons in the Find bar to cycle through matching occurrences.
- Close the Find bar by clicking the red "x" icon
in the Find bar.
- Restore the view by right-clicking the tab for the file and choosing Restore Window from the pop-up menu.
View Demo
top
Switching Between XML Schema Editor Views
You can use the right-click pop-up menu to quickly switch between the Source, Schema, and Design views in the XML schema editor.
To switch between XML schema editor views:
- If mySchemaPrj is not open in the IDE, open it now and then open the newLoanApplication schema file.
- Maximize the view by right-clicking the tab for the file and choosing Maximize Window from the pop-up menu.
Maximizing the view lets you see more information about the shema in the column view of the Schema view.
- In the Schema view, click the column button
to make sure you are in the column mode of the view.
- In the first column of the view, select the Complex Types node.
- In the second column, select the DurationType node, right-click and choose Go To > Source.
The IDE replaces the Schema view with the Source view and highlights the first line of the block for the DurationType complex type.
- In the Source view, position the cursor in the definition of the years element within the DurationType complex type definition.
The line looks like this:
<xs:element name="years" type="xs:positiveInteger"/>
- Right-click and choose Go To > Schema.
The IDE replaces the Source view with the Schema view and highlights the years element in the view.
- Right-click the years node and choose Go To > Design.
The IDE replaces the Schema view with the Design view and highlights the years element in the view.
- In the Design view, select the autoLoanApplication global element node at the top of the schema design area.
- Right-click and choose Go To > Schema.
The IDE replaces the Design view with the Schema view and highlights the autoLoanApplication element in the second column of the view.
View Demo
top
Next Step
The steps in Working With XML Schema Components show you how to add, edit, and delete schema components, how to undo and redo your actions, how to take advantage of drag-and-drop functionality, and how to use cut, copy, and paste functions.
top