XML editor

The XML editor is a tool for creating and viewing XML files

You can use it to perform a variety of tasks such as the following:

To make the XML editor the default editor for XML files, select Window > Preferences > Workbench > File Associations, then select *.xml and XML Editor from the Associated Editors list. Click OK.

The XML editor has two main views - the Source view and the Design view.

Source view

The Source view enables you to view and work directly with a file's source code directly.

The Source view has many text editing features, such as syntax highlighting, unlimited undo/redo, and user-defined macros. Another helpful feature is content assist, which uses the information in a DTD or schema content model to provide a list of acceptable continuations depending on where the cursor is located in an XML file, or what has just been typed. The XML editor Source view also includes a "smart" double-clicking behavior. If your cursor is placed in an attribute value, one double-click selects that value, another double click selects the attribute-value pair, and a third double-click selects the entire tag. This makes it easier to copy and paste commonly used pieces of XML.

Design view

The XML editor also has a Design view, which represents the XML file simultaneously as a table and a tree. This helps make navigation and editing easier. Content and attribute values can be edited directly in the table cells, while pop-up menus on the tree nodes give alternatives that are valid for that location. For example, the Add child menu item will list only those elements from a DTD or XML schema which would be valid children at that point (as long as grammar constraints are on).

The Design view is especially helpful if you are new to XML, or need to do form-oriented editing. For example, you could use the Create XML File wizard to create a template XML file for a job description form from a job description  DTD. After those steps are completed, you would only have to fill in the form data using the Design view.

Note: You can also use the Outline view to insert and delete elements.

Parent topic: Editing XML files

Related concepts
XML file associations with DTDs and XML schemas

Related tasks
Creating an XML file from scratch

Editing in the Design view
Editing in the Source view

(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.