xml spy
Previous  Top  Next

Entering Data in Text View


Text View is ideal for editing the actual data and markup of XML files because of its DTD/XML Schema-related intelligent editing features.

 

Structural editing features

In addition, Text View provides a number of structural editing features that make editing large sections of text easy. Among these latter features are the following, which can be toggled on and off by clicking the appropriate icon.

 

ic-txt-lines        Enables/disables line numbering.

 

ic-txt-expand-marg        Enables/disables the source folding margin.

 

ic-txt-book-margin        Enables/disables the bookmark margin.

 

ic-txt-bk-ins        Inserts/removes bookmarks.

 

ic-txt-indent        Enables/disables indentation guides.

 

The screenshot below shows the current XML file in Text View with all structural editing features enabled. For the sake of clarity, none of the line numbers, indentation guides, etc, will be shown in Text View in rest of this tutorial. Please see the User Manual for more information on Text View.

 

 

 

tut-txtv-home

 

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.

 

       tut_39a

 

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.

 

       tut_40a

 

5.From the dropdown list for the Manager attribute, select true.

 

       tut_40b

 

Press Enter to insert the value true at the cursor position.

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, this time 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).

 

       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 | Enhanced 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.


Previous  Top  Next

© 2008 Altova