Please enable JavaScript to view this site.

Altova XMLSpy 2022 Professional Edition

About Table Display

In standard Grid View, if an element repeats, then each element instance is displayed, one after the other in document order. In the screenshot below, for example, the Person element is the repeating element.

GridViewNormal

A repeating element, such as the Person element shown above, can also be displayed as a table (screenshot below). In table representation, child nodes of the repeating element form the table's columns, while instances of the repeating element form the table's rows. To switch to Table View, click the Table Mode icon that is shown on the first instance of the repeating element (circled in green in the screenshot above). When switched to table display, the Table Mode icon is displayed in color (see screenshot below).

GridViewTable

Table View offers a unique editing advantage in that whole rows and columns can be manipulated relative to other columns and rows in the table. This enables such operations as sorting rows on the values of one column. For example, in the screenshot above, the six Person elements can be sorted on the basis of their Last child elements via a simple GUI operation. Such an operation (see below for details) is simpler than running an XSLT transformation, which is the usual way to sort an XML nodeset.

 

Note

Table Display can be applied only to a sequence of elements of the same name.

Table Display is also available for a single element. The element's Table Mode icon becomes visible when the element is clicked.

Table Display colors can be set in the Options dialog: Fonts and Colors | Grid View | Cell Colors.

 

Icons for viewing and editing in Table Display

The icons shown below are available in Table Display and provide viewing and editing functionality. They are available in table cells and/or the Grid View toolbar.

 

ic_opt_widths

Optimizes widths of grid columns according to cell content.

ic_jsongridmakelist / ic_jsongridmaketable

When colored, Table Display is on, otherwise off. Click to switch the display

ic_jsongridrowcols / ic_jsongridcolrows

A toggle command in top left cell of table. Switches rows to columns and vice versa

ic_jsongridfilteroff / ic_jsongridfilteron

When colored, a filter for the table, object, or array is active, otherwise the filter s deactivated. Click to deactivate/activate. To edit the expression, double-click it

ic_xmlgridviewwordwrap

Toggle command to word-wrap cells. When selected, word-wrap is on. By default. only the contents of items are wrapped. If you want to additionally wrap the names of items, choose this option from the icon's dropdown list.

ic_xmlgridviewmagnification

Zoom level of Grid View

ic_xmlgridviewsort

Enabled when a column header in Table View is selected. The buttons sort the rows of the table, respectively, in descending or ascending order of column content

 

 

Editing in Table Display

In Table Display, you can carry out the editing actions described below.

 

Add a table row (new instance of the table's repeating element)

You can add a new row—that is, another instance of the table's repeating element—as follows:

 

1.Right-click the cell containing the row number of the row above or below which you want to add a new row.

2.Select the command Insert After (Ctrl+Enter) to add a row below the selected row, or Insert Before (Ctrl+Shift+Enter) to add a row above the selected row. These commands are also available in the XML menu and the Grid View toolbar.

 

The new row will be created as an element node. You can change its node type if you want (see below for details).

 

 

Add sibling or child elements to a table cell

If a table cell represents a child element of a table row, then you can give this child element a following-sibling node or a child node. Right-click the table cell and select the command Append (Ctrl+Alt+A) or Add Child (Ctrl+Alt+Enter), respectively. These commands are also available in the XML menu and the Grid View toolbar. The new row will be created as an element node. You can change its node type if you want (see below for details).

 

 

Wrap cell in element

You can create an element around a table cell. The new element will be created at a level between that of the cell and that of the cell's parent. To do this, right-click the table cell and select the command Wrap in Element (Ctrl+Alt+W). This command is also available in the XML menu and the Grid View toolbar.

 

 

Add a table column (new child node of all instances of table's repeating element)

You can add a new column—that is, a new child node of all instances of the table's repeating element—as follows:

 

1.Right-click a column header or a non-empty cell of a column.

2.Select the command Insert After (Ctrl+Enter) to add a column to the right of the selected column, or Insert Before (Ctrl+Shift+Enter) to add a column to the left of the selected column. These commands are also available in the XML menu and the Grid View toolbar.

 

The new column will be created as an element node. You can change its node type if you want (see below for details).

 

 

Change node types and names of columns

To change the node type of a column, click the node type icon of the column and, from the menu that appears, select the new node type. The type of this node will be changed for all instances of the repeating element.

 

To change the name of a column header, double-click the name and edit it. As a result, the name of this node will be changed in all instances of the repeating element.

 

 

Sort table rows on the values of a selected column

You can sort the rows of a table on the relative values of one of its child nodes (a column). For example, you can sort rows on the basis of the LastName column to give you the repeating elements of the table sorted alphabetically. To sort on a column, select the column header and then click the Grid View toolbar command Ascending Sort or Descending Sort. These commands are also available in the XML menu.

 

Table Display and external applications

You can take advantage of the table structure to exchange data between Table Display and a spreadsheet application (such as MS Excel). To move data from Table Display, do the following:

 

1.In Table Display, select the nodes you want to copy. Do this by clicking the cells themselves, column headers, row headers, or the entire table. If you click the entire table or column headers, then column headers are also copied; otherwise they are not. (In the screenshot below, rows 2 and 3 are selected.)

view_table

2.Select the context menu command Copy | Copy as Tab-separated Text.

3.Paste the data directly into the spreadsheet program.

view_excel

 

Data exchange works in both directions. You can also copy data from a spreadsheet to Table Display. Do this as follows:

 

1.Select a range in the external application and copy it to the clipboard (with Ctrl+C).
2.Select a single cell in Table Display.
3.Paste the copied data with Ctrl+V.

 

The data will be pasted into the table with a structure corresponding to the original structure and starting from the cell selected in Table View. The following points need to be noted:

 

If data already exists in these cells in Table View, the new data overwrites the original data.

If more rows and/or columns are required to accommodate the new data, these are created.

The data becomes content of the elements represented by the respective cells.

 

For more complex data exchange tasks, use the unique import/export functions of XMLSpy.

 

© 2015-2021 Altova GmbH