Altova XMLSpy 2025 Professional Edition

Document Structure

Home Prev Top Next

In Grid View, the XML, JSON, YAML, or DTD document structure can be edited graphically. For example, you can insert, append and delete nodes, drag-and-drop nodes to different locations, and convert one type of node to another type.

 

Adding new nodes

There are two ways to add new nodes to the document:

 

The Siblings and Children entry helpers enter specific nodes at the selected location.

You can add a new node that is not defined in a schema as a sibling, child, or parent.

 

Siblings and Children entry helpers

How the Siblings and Children entry helpers is explained here with reference to an XML document that is associated with a schema (DTD or XML Schema). A JSON or YAML document that is associated with a JSON Schema would work in a similar way.

 

When a node is selected in the Main Window, the sibling and children that are allowed at that point (according to the schema) are displayed in the Siblings and Children entry helpers, respectively.

 

In each of these entry helpers, use the toolbar icons to toggle the visibility of elements and attributes on or off. Mandatory nodes are displayed with an exclamation mark.

Nodes in gray cannot be added. This is because of one of the following reasons: (i) The node has already been added, and no more instances of it are allowed by the schema, as in the case of the Address sibling in the screenshot below; (ii) Another node needs to be added before the grayed out node can be added, as in the case of the Last child in the screenshot below, which can be added only after the First child has been added.

XSXMLGridViewEntryHelpersSibChild

Add nodes as follows:

 

Siblings: In the entry helper, select the node you want to add as a sibling. Then click the appropriate icon (see screenshot above left), depending on whether you want to add the sibling after or before the node selected in the grid, or append it as the last of the selected node's siblings.

Children: Double click the node you want to add as a child.

 

Inserting new nodes

When a node in the document (that is, a grid cell) is selected, you can add a new empty node as a sibling, child, or parent. The commands for these operations are listed in the table below, and are available in: (i) the context menu of the cell; (ii) the XML menu or JSON menu; and (iii) the Grid View toolbar.

 

Command

Shortcut

Insert (Sibling) After

Ctr+Enter

Insert (Sibling) Before

Ctr+Shift+Enter

Append (Sibling)

Ctr+Alt+A

Add Child

Ctr+Alt+Enter

Add Attribute (XML)

Ctrl+Alt+I

Wrap in Element (XML)

Ctr+Alt+W

Wrap in Array (JSON)

Ctrl+Alt+W

Wrap in Object (JSON)

Ctrl+Shift+W

Edit Anchor (YAML)

--

 

Note the following points:

 

The new node is created as an empty element (XML) or empty property (JSON/YAML) by default. You can change the node type subsequently.

The Wrap in Element command creates an element node around the current node. This element becomes the new parent of the current node. The Wrap in Array and Wrap in Object commands in JSON documents work similarly.

The Edit Anchor command creates an Anchor node if none exists. If an anchor already exists, it is highlighted for editing. To remove an anchor, delete its name.

 

Modifying structure with standard Windows mechanisms

In Grid View, you can also modify document structure using the following Windows mechanisms:

 

Delete: Select a component and delete it with the Delete key.

Move: Select a component and drag-and-drop it to a new location.

 

© 2018-2024 Altova GmbH