Adding Elements and Attributes

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  XMLSpy Tutorial > XML Documents >

Adding Elements and Attributes

At this point, there is only one Person element in the document.

 

To add a new Person element:

 

1.Click the gray sidebar to the left of the Address element to collapse the Address element. This clears up some space in the view.
2.Select the entire Person element by clicking on or below the Person element text in Grid View. Notice that the Person element is now available in the Append tab of the Elements Entry Helper.

tut_47a

3.Double-click the Person element in the Elements Entry Helper. A new Person element with all mandatory child elements is appended (screenshot below). Notice that the optional Title child element of Person is not inserted.

tut_48a_tableview

4.Switch to Grid View and then press F12 to switch the new Person element from Table View to normal Grid View.
5.Click on the Manager attribute of the new Person element. Take a look at the Attributes Entry Helper. The Manager entry is grayed out because it has already been entered. Also look at the Info Window, which now displays information about the Manager attribute. It is a required attribute and has therefore been added. The Programmer attribute has not been added.
6.In the Append tab of the Attributes Entry Helper, double-click the Programmer entry. This inserts an empty Programmer attribute after the Manager attribute.

tut_48c

The Programmer attribute is now grayed out in the Attributes Entry Helper.

 

You could enter content for the Person element in this view, but let's switch to the Database/Table View of Grid View since it is more suited to editing a structure with multiple occurrences, such as Person.

 


© 2019 Altova GmbH