Home >
Online Product Documentation >
Table of Contents >
Features of the Grid Tab
Features of the Grid Tab
This section describes the layout and features of the
Grid tab. It covers the following topics:
Layout of the Grid Tab
The
Grid tab consists of a tool bar and a display area. The tool bar has buttons to perform actions and operations on both the grid itself and on the underlying XML document represented in the grid. An example of the former is the ability to show the child elements of the document's root element; they are hidden by default. An example of the latter is the ability to add a new instance of an element or to change a value. These operations are also accessible from the
XML > Grid Editing menu, as well as from the grid shortcut menu (right-click on the grid).
The tool bar also includes a query field, which allows you to enter an XPath expression to query the XML document. Results are displayed in the
Query Output window, which appears when you run the query if it is not already displayed. See
Querying XML Documents Using XPath for more information on this feature.
The display area shows the XML document, both its structure and content, rendered in a tabular, or grid format.
Expanding and Collapsing Nodes
When you first display a document in the
Grid tab, the document is collapsed so that it shows just the root element (here it is
<books>) and its name attribute (
My books), as shown in
Figure 109.
|
|
Figure 109. Default Display - Document Elements Are Collapsed
A plus sign displayed to the left of the node name indicates that this node has child nodes. You can click the plus sign to display a subgrid that displays the child nodes, as shown in
Figure 110.
|
|
Figure 110. Click Plus Signs to Expand Collapsed Tables
You can continue to drill down in this fashion to view all values.
To expand a node, click the plus sign (
).
Resizing Columns
When you expand a node, Stylus Studio displays it in uniform columns. You can resize columns to any width you prefer by dragging the handle on the right side of the column header, as shown in
Figure 111.
|
|
Figure 111. Resize Columns by Dragging the Right Handle
To resize a column, drag the handle on the right side of the column header.
Showing Row Tag Names
In the grid view of a structured XML document, each child element of a node corresponds to a row in a table. For example, the
<books> node of
books.xml contains nine child elements; each row is an instance of the
<book> element. To preserve space in the grid, the tag names of child elements are not displayed as a separate column in the table. Rather, as shown in
Figure 110, this information is displayed in the table header itself.
If you want, you can display the tag name for child elements in their own columns, as shown in
Figure 112.
|
|
Figure 112. Displaying the Root's Child Element
To toggle the display child element names, click Toggle Row Tag Name (
).
This action is also available from the
XML > Grid Editing menu.
Collapsing Empty Nodes
Some nodes in a document are simply containers - they have no content of their own. An example of a container node is the
<authors> element in
books.xml. The
<authors> element is simply a container for one or more
<author> elements, as shown in this excerpt of
books.xml:
To streamline the display, Stylus Studio hides the tables that represent container nodes. Information about container nodes is displayed in the child node's header.
Figure 113 shows the default display for the
author element. Notice that the header,
book/authors/author, contains information about the container node,
authors.
|
|
Figure 113. Table Headers Show Full Path
If you want, however, you can display the tables associated with container nodes, as shown in
Figure 114.
|
|
Figure 114. Container Nodes Are Hidden by Default
The table associated with the
authors node now appears in the grid; it is empty (it has no rows) because it is a container. The elements it contains are displayed in their own table,
authors/author.
To display container nodes, click Simplified View (
).
This action is also available from the
XML > Grid Editing menu and from the grid shortcut menu.