blob: e2c17628a4a33393a8135bdd17d2ad2ffbc3277e [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<!-- /*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/ -->
<link rel="stylesheet" type="text/css" href="../../org.eclipse.wst.doc.user/common.css" />
<title>Editing in the Source view</title>
<body id="txedtsrc"><a name="txedtsrc"><!-- --></a>
<h1 class="topictitle1">Editing in the Source view</h1>
<div><p>You can use the Source view to view and work with a file's source
code directly.</p><div class="skipspace"><p> The Source view has many text editing features, such as:</p>
<dl><dt class="bold"><b>Syntax highlighting</b></dt>
<dd>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 <samp class="codeph">&lt;!--</samp> everything until the next <samp class="codeph">--&gt;</samp> is
considered a comment, and will be highlighted accordingly. The large highlighted
area will indicate that you need to add <samp class="codeph">--&gt;</samp> to close the
comment.<p>You can customize the syntax highlighting. Refer to the related
tasks for more information.</p>
<dl><dt class="bold"><b>Unlimited undo and redo</b></dt>
<dd>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.</dd>
<dt class="bold"><b>Content assist</b></dt>
<dd>Content assist helps you finish tags and insert macros. Refer to
the related task for more details.</dd>
<dt class="bold"><b>Template</b></dt>
<dd>You can access templates (using content assist) to help you quickly add
regularly-used tagging combinations. Refer to the related task for more details.</dd>
<dt class="bold"><b>Node selection</b></dt>
<dd>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.</dd>
<dt class="bold"><b>Pop-up menu options</b></dt>
<dd>From the editor's pop-up menu, you have many of the same editing options
available as you do from the workbench <b>Edit</b> menu. You can select menu
options such as: <span class="uicontrol"><b>Cleanup Document</b>,</span> to open the <span class="uicontrol">Cleanup</span>
dialog, which contains settings to update a document so that it is well-formed
and formatted and <span class="uicontrol"><b>Format</b>,</span> which formats either the
entire document or selected elements.</dd>
<dt class="bold"><b>"Smart" double clicking</b></dt>
<dd>You can use double-click to select attribute values, attribute-value pairs,
and entire tag sets to quickly update, copy, or remove content.</dd>
<p>To edit an XML file in the Source view, follow these steps:</p>
<ol><li class="skipspace"><span>Open the XML file you want to work with in the XML editor (right-click
the file in the Navigator view and click <b> <span class="uicontrol">Open With &gt; XML Editor</span></b>). </span> You may need to click the <span class="uicontrol">Source</span> tab. Typically,
all that you will need to do to open the file is to double-click it in the
Navigator view. If this does not work, right-click it and click <b> <span class="uicontrol">Open
With &gt; XML Editor</span></b>.</li>
<li class="skipspace"><span>Edit the code as necessary, using any of the available features.</span> 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.</li>
<li class="skipspace"><span>At intervals, you may wish to format individual nodes, or the entire
XML file to restore element and attribute indentation to see nesting hierarchies
more clearly in the file.</span></li>
<li class="skipspace"><span>If desired, validate and save the XML file.</span></li>
<div class="skipspace"><p>Any changes you make in the Source view are also reflected in the
Design view and the Outline view.</p>
<p><b class="relconceptshd">Related concepts</b><br />
<a href="../topics/cwxmledt.html" title="The XML editor is a tool for creating and viewing XML files">XML editor</a><br />
<a href="../topics/cxmlcat.html" title="There are two different ways to associate XML files with DTDs or XML schemas.">XML file associations with DTDs and XML schemas</a><br />
<p><b class="reltaskshd">Related tasks</b><br />
<a href="../topics/txedtdes.html" title="The XML editor 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 elements give alternatives that are valid for that particular element.">Editing in the Design view</a><br />
<div><a href="../topics/twcdast.html" title="You can use content assist to help you finish a tag or line of code in the Source view of the XML editor. You can also use content assist to insert templates into your XML code.">Using XML content assist</a></div>
<div><a href="../topics/twmacro.html" title="XML content assist provides a comment template, a chunk of predefined code that you can insert into a file. You may find a template useful when you have a certain piece of code you want to reuse several times, and you do not want to write it out every time.">Working with XML templates</a></div>
<div><a href="../topics/ttaghilt.html" title="If desired, you can change various aspects of how the XML source code is displayed in the Source view of the XML editor, such as the colors the tags will be displayed in.">Setting source highlighting styles</a></div></p>