Editing in Text View
The following text editing features are available in Text View generally for all document types. These features are in addition to common features of editing applications, such as Cut, Copy, Paste, Delete, and Select All (which are available as commands in the Edit menu).
•Start-tag and end-tag matching
•Moving siblings relative to each other
•Selecting an entire element and going to parent
•Drag-and-drop and context menus
For some document types (such as XML and XQuery) additional specialized features are available, and these are described, respectively, in the sections that deal with those document types.
|Note:||For large files, Auto-completion and entry helpers can be disabled, thus enabling faster loading and editing. The threshold file size is specified by the user. For more details, see the reference section Options | Editing.|
Syntax coloring is applied according to the semantic value of the text. For example, in XML documents, depending on whether the XML node is an element, attribute, content, CDATA section, comment, or processing instruction, the node name (and in some cases the node's content) is colored differently. A number of document type are distinguished, such as: (i) generic XML (which includes HTML); (ii) XQuery; (iii) CSS; and (iv) JSON. The text properties (including color) of each group can be set in the Text Fonts section of the Options dialog (Tools | Options).
If you are working with an XML document based on a schema, XMLSpy provides you with various intelligent editing capabilities in Text View. These allow you to quickly insert the correct element, attribute, or attribute value according to the content model defined for the element you are currently editing. For example, when you start typing the start tag of an element, the names of all the elements allowed by the schema at this point are shown in a pop-up (screenshot below). Selecting the required element name and pressing Enter inserts that element name in the start tag. Also, after the start tag is created, the end tag is automatically added (see Auto-completion below).
Popup windows also appears in the following cases:
•When the cursor is inside the start tag of an element that has an attribute defined for it and the space bar is pressed. The popup will contain all available attributes.
•When the cursor is within the double-quotes delimiting an attribute value that has enumerated values. The popup will contain the enumerated values.
•When you type </ (which signifies the start of a closing tag), the name of the element to be closed appears in the popup.
•When you wish to write an empty element as a single tag or convert an empty element of two tags to an empty element of one tag, type in the closing slash after the element name: <element/. An empty element with a single tag is created; if a close tag exists, it is removed: <element/>.
Editing in Text View can easily result in XML and other marked-up documents (such as HTML) that are not well-formed. For example, closing tags may be missing, mis-spelled, or structurally mismatched. XMLSpy automatically completes the start and end tags of elements, as well as inserts all required attributes as soon as you finish entering the element name on your keyboard. The cursor is also automatically positioned between the start and end tags of the element, so that you can immediately continue to add child elements or contents: <img src="" alt=""> </img>
XMLSpy makes use of the XML rules for well-formedness and validity to support auto-completion. The information about the structure of the document is obtained from the schema on which the document is based. (In the case of well-used schemas, such as HTML and XSLT, the schema information is built into XMLSpy.) Auto-completion uses not only information about the structure of the document, but also the values stored in the document. For example, enumerations and schema annotations in an XML Schema are actively used by the Auto-Completion feature. If, in the schema, values are enumerated for a particular node, then those enumerations will be displayed as auto-completion options when that node comes to be edited. Similarly, if, for a node, annotations exist in the schema, then these annotations are displayed when the node name is being typed in the document (screenshot below). (First (given) name of person is the schema annotation of the First element.)
Auto-completion can be switched on and off in the Editing section of the Options dialog (Tools | Options | Editing).
Start-tag and end-tag matching
When you place the cursor inside a start or end tag of a markup element, pressing Ctrl+E moves the selection to the other member of the pair. Pressing Ctrl+E repeatedly enables you to switch repeatedly between the start and end tags. This feature is an excellent aid for quickly locating the start and end tags of an XML element. Additionally, the names of elements are highlighted in two different colors according to whether the names in the start and end tags match or not. This serves as a visual editing aid. The highlight colors can be set in the Options dialog. When you edit the name of an element in a start tag, then the end tag will be automatically edited as well.
Moving sibling elements relative to each other
When the cursor is within an element, pressing Alt+ArrowUp or Alt+ArrowDown moves the selected element up or down relative to its siblings.
Selecting an entire element and going to parent
When the cursor is within an element, pressing Ctrl+Shift+E selects the entire element. If you click Ctrl+Alt+E, the start tag of the parent element is highlighted. Both these shortcuts help you to quickly locate your current cursor position relative to the document structure.
Find and Replace
The Find and Replace features (accessed via the Edit menu) provide powerful search capabilities. The search term can be defined additionally in terms of casing and whether whole words should be matched, and it can also be expressed as a regular expression. The search range can be restricted to a selection in the document and to particular node types (see screenshot below).
For a description of the Find and Replace functionality, see the descriptions of the Find and Replace commands in the Edit menu
Drag-and-Drop and Context Menus
You can also use drag-and-drop to move a text block to a new location, as well as right-click to directly access frequently used editing commands (such as Cut, Copy, Paste, Delete, Send by Mail, and Go to line/char) in a context menu.
XMLSpy offers unlimited levels of Undo and Redo for all editing operations.
In Text View, documents can be spellchecked with any of the built-in language dictionaries. A user dictionary can also be created and edited to allow words not contained in the language dictionary. For details, see the descriptions of the Spelling and Spelling Options commands.