Please enable JavaScript to view this site.

Altova XMLSpy 2020 Enterprise Edition

Text View presents the actual data and markup of XML files in an easy-to-follow structural layout, and provides schema-related intelligent editing features. Individual Text View features can be switched on and off in the Text View Settings dialog (View | Text View Settings, screenshot below).

TextViewSettingsDlg

The screenshot below shows the current XML file in Text View with features switched on according to the settings in the dialog above.

tut-txtv-home

On the left are the three margins: (i) the line number margin, (ii) the bookmark margin (containing two blue bookmarks), and (iii) the source folding margin (which allows you to expand and collapse the display of XML elements).

 

Additionally, visual aids such as indentation guides, end-of-line markers, and whitespace markers can be switched on and off, by checking and unchecking, respectively, their check boxes in the Visual Aid pane of the Text View Settings dialog (see screenshot above). The screenshot above has indentation guides switched on, and shows one indentation guide, at the Address element.

 

Note:The Text View-related pretty-printing and bookmark features were covered in the earlier Text View Settings section of this tutorial.

 

Editing in Text View

In this section, you will enter and edit data in Text View in order to become familiar with the features of Text View.

 

Do the following:

 

1.Select the menu item View | Text view, or click on the Text tab. You now see the XML document in its text form, with syntax coloring.
2.Place the text cursor after the end tag of the Address element, and press Enter to add a new line.
3.Enter the less-than angular bracket < at this position. A dropdown list of all elements allowed at that point (according to the schema) is displayed. Since only the Person element is allowed at this point, it will be the only element displayed in the list.

intelliedit_insert_element

4.Select the Person entry. The Person element, as well as its attribute Manager, are inserted, with the cursor inside the value-field of the Manager attribute.
5.From the dropdown list that pops up for the Manager attribute, select true.

tut_40b

6.Move the cursor to the end of the line (using the End key if you like), and press the space bar. This opens a dropdown list containing a list of attributes allowed at that point. Also, in the Attributes Entry Helper, the available attributes are listed in red. The Manager attribute is grayed out because it has already been used.

tut_40c

7.Select Degree with the Down arrow key, and press Enter. This opens another list box, from which you can select one of the predefined enumerations (BA, MA, or PhD). (Enumerations are values that are allowed by the XML Schema.)

tut_40e

8.Select BA with the Down arrow key and confirm with Enter. Then move the cursor to the end of the line (with the End key), and press the space bar. Manager and Degree are now grayed out in the Attributes Entry Helper.

tut_40f

9.Select Programmer with the Down arrow key and press Enter.

tut_41a

10.Enter the letter "f" and press Enter.
11.Move the cursor to the end of the line (with the End key), and enter the greater-than angular bracket >. XMLSpy automatically inserts all the required child elements of Person. (Note that the optional Title element is not inserted.) Each element has start and end tags but no content.

tut_41b

You could now enter the Person data in Text View, but let's move to Grid View to see the flexibility of moving between views when editing a document.

 

Switching to Grid View

To switch to Grid View, select the menu item View | Grid View, or click the Grid tab. The newly added child elements of Person are highlighted.

tut_42a

Now let us validate the document and correct any errors that the validation finds.

 

© 2019 Altova GmbH