> ### Document Tree Popup Menu The popup menu is shown when the user performs a right-click on a selected node or a set of selected nodes in the tree panel on the left side of the screen. The menu commands allow the user to change the structure of the document, to apply XML Tool queries and others. Here follows a list of descriptions of the menu items: |

> ### Menu Commands Description

> 1. Delete Subtree

>    Allows the user to delete the selected node(s) in the tree with the entire subtree(s) below it (them). This operation uses "Before" and "After" columns from the Element Features to determine whether to insert space symbol before and after the deleted element. The system will warn the user if, after the deletion, the structure of the document is non-valid.

> 2. Delete Node

>    Allows the user to delete only the selected nodes. The children of the selected nodes will be inserted as children of the parent of the corresponding selected node. This operation uses "Before" and "After" columns from the Element Features to determine whether to insert space symbol before and after the deleted element. The system will warn the user if, after the deletion, the structure of the document is non-valid.

> 3. Set Attribute

>    Allows the user to insert an attribute to the selected nodes. The system will give the user the choice between valid attributes (attributes which can be inserted at the specified position according to the DTD) or to define a new attribute. If more than one nodes are selected - given attributes are intersection of the attributes specified for each node.

> 4. Element Child

>    Allows the user to insert a first child element node to the selected nodes. The system will give the user a choice between valid tags (tags which can be inserted at the specified position according to the DTD) and all tags (all tags defined in the DTD).

> 5. Element Sibling

>    Allows the user to insert a following sibling to the selected nodes. The system will give the user a choice between valid tags (tags which can be inserted at the specified position according to the DTD) and all tags (all tags defined in the DTD).

> 6. Text Child

>    Inserts a first child text node to the selected nodes. It can be edited in the Tree Area by double click on the text node or in the Text Area.

> 7. Text Sibling

>    Inserts a following sibling child text node to the selected nodes.

> 8. Comment Child

>    Allows the user to insert a first child comment node to the selected nodes.

> 9. Comment Sibling

>    Allows the user to insert a following sibling comment node to the selected nodes.

> 10. Parent

>     After correcting the selection (if needed), a Change Parent dialog appears.

>     This dialog allows the user to choose a tag, which will be the new parent of the (newly) selected nodes. The selected nodes are then replaced with the chosen tag that has as children the selected nodes (and their subtrees). The system allows the user to constrain the possible parents in 4 ways.

>     1. To choose from all tags, that are possible for selection, i.e that can have selected nodes for children
>     2. To choose from tags, such that the parent node of the selected nodes will be valid after the operation is completed.
>     3. To choose from tags that can have the selected nodes for children.
>     4. To choose from tags that are produced from PARENT value constraints of the selected nodes.

>     Any combination of the above constraints is possible.

> 11. Rename

>     This item renames the selected nodes (only if they are element nodes). The system will allow the user to choose from tags, such that the corresponding parent node(s) will be valid after the operation is completed or to choose from tags, such that the selected nodes will be valid, or both.

> 12. Apply query

>     Allows the user to apply a query ( Concordance, Constraints, Extract, Grammar, InsertAttribute, InsertChild, InsertParent, InsertSibling, MultiQuery, Remove, Rename, Sort, Statistics, TextReplace, XSLT) over selected nodes.

> 13. Copy

>     This item copies the selected nodes, including their subtrees, to a copy buffer. After applying the Copy operation the buffer contains a set of trees - one for each selected node.

> 14. Cut

>     This copies the selected nodes (including their subtrees) to a copy buffer and then deletes the nodes from the tree. The system will warn the user if, after the deletion, the structure of the document becomes non-valid. After applying the Cut operation, the copy buffer contains a set of trees - one for each selected node.

> 15. Paste As Child

>     This pastes the copy buffer as a first child of the selected node(s). If the copy buffer contains more than one tree, the trees are inserted as neighbour children. The system will warn the user if, after the insertion, the structure of the document becomes non-valid. If it is applied to a multiple selection of nodes, the copy buffer will be cloned, as many times as an insertion will be performed.

> 16. Paste As Sibling

>     This pastes the copy buffer as a following sibling of the selected node(s). If the copy buffer contains more than one tree, the trees are inserted as neighbour siblings of the selected node(s). The system will warn the user if, after the insertion, the structure of the document becomes non-valid. If it is applied to a multiple selection of nodes, the copy buffer will be cloned, as many times as an insertion will be performed.

> More ...

> 17. Info

>     This item gives information about the selected node and its content. The given information includes: the path from the root node to the current one (abbr. XPath), the tokenizer attached to the node, the content of the node (tags & tokens). This operation cannot be applied to a multiple selection of nodes.

> 18. Errors Info

>     This item gives all errors for the selected nodes from the tree in the document order. There are two modes - Selected Nodes and Subtree Nodes of Selected Nodes. In the Selected Nodes mode the dialog shows all the errors of the selected nodes. In the Subtree Nodes of Selected Nodes mode the dialog shows all the errors for all the subtrees of the selected nodes.

>     Each error is colored depending on the error group. For more details see Error Message Panel.

> 19. Trim Text Nodes

>     This item removes the leading and trailing white space characters (spaces, tabs and new lines) of the text nodes, descendants of the selected nodes and of the nodes themselves (if they are text nodes).

> 20. Expand Subtree

>     This item is used when the tree (or parts of it) on the left panel is folded and the user wants to see the whole substructure of it (them) unfolded. Instead of passing through all folded nodes and manually unfolding them, the user can expand everything, which is under a certain (selected) node by using this option. This option can be applied to more than one selected node.

> 21. Collapse Subtree

>     This item is used to collapse one or more selected subtrees in the tree area. The function is an opposite to the Expand Subtree function.

> 22. RegExpr. Constraints

>     Allows the user to apply regular expression constraints over the content of the selected node(s) (or the node itself, if it is a text node). When the user selects this item, he/she is given a list of all regular expression constraints defined in the system. The manager, responsible for creating and modifying such constraints can be started from the menu: Constraints/Regular Expression Constraints/Edit Regular Expression Constraints. More details about Regular Expression Constraints usage can be found in the description of the main menu items of the CLaRK System (Constraints/Regular Expression Constraints).

> 23. Invoke XSLT

>     This item applies an XSLT transformations over the selected node. It means that the system uses the selected node as the starting point for the XSLT, not the root of the document, which would be the case when running it from the main menu. If the XSLT returns more than one root, all the roots are inserted in the place of the selected node. This operation cannot be applied to multiple selection of nodes.