Editing in the Source view

You can use the Source view to view and work with a file's source code directly.

The Source view has many text editing features, such as:

Syntax highlighting
Each tag type is highlighted differently, enabling you to easily find a certain kind of tag for editing. In addition, syntax highlighting is valuable in locating syntax errors. For example, if you begin a comment in the middle of the document with <!-- everything until the next --> is considered a comment, and will be highlighted accordingly. The large highlighted area will indicate that you need to add --> to close the comment.

You can customize the syntax highlighting. Refer to the related tasks for more information.

Unlimited undo and redo
These options allow you to incrementally undo and redo every change made to a file for the entire editing session. For text, changes are incremented one character or set of selected characters at a time.
Content assist
Content assist helps you finish tags and insert macros. Refer to the related task for more details.
Template
You can access templates (using content assist) to help you quickly add regularly-used tagging combinations. Refer to the related task for more details.
Node selection
Based on the location of your cursor (or selection in the Outline view), the node selection indicator highlights the line numbers that include a node (for example, an element or attribute), in the vertical ruler in the left area of the Source view.
Pop-up menu options
From the editor's pop-up menu, you have many of the same editing options available as you do from the workbench Edit menu. You can select menu options such as: Cleanup Document, to open the Cleanup dialog, which contains settings to update a document so that it is well-formed and formatted and Format, which formats either the entire document or selected elements.
"Smart" double clicking
You can use double-click to select attribute values, attribute-value pairs, and entire tag sets to quickly update, copy, or remove content.

To open an XML file to edit, right-click the file in the Navigator view and select Open With > XML Editor. Click the Source to see the Source view.

Edit the code as necessary, using any of the available features. As you move the cursor within your XML file (or select items from the Outline view), the node selection indicator will highlight the line numbers that encompass the node (for example, an element or attribute). You can use smart double-clicking behavior to select attribute values, attribute-value pairs, and entire tag sets to quickly update, copy, or remove content. If desired, validate and save the XML file.

Any changes you make in the Source view are also reflected in the Design view and the Outline view.

Related concepts
XML editor
XML file associations with DTDs and XML schemas
Related tasks
Editing in the Design view
Using XML content assist
Working with XML templates
Setting source highlighting styles