Home >Online Product Documentation >Table of Contents >Updating the Text of a Sample Document
When you update an XML document in the Text view of the XML editor, you can use the usual editing tools, as well as tools tailored for handling XML.
Each of the following topics contains instructions for editing a sample XML document. You should perform the steps in each topic before you move on to the next topic. After the first topic, some steps depend on actions you performed in a previous topic.
For more information on editing tools and features, see Using the Text Editor.
This section provides instructions for
Stylus Studio lets you optionally display line numbers in most of its editors. Line numbers provide simple, unobtrusive points of reference that can make working large or complex documents easier. Line numbers are off by default; turn them on now.
Stylus Studio displays the Options dialog box.
<quote><company>data</
As soon as you type the closing forward slash, Stylus Studio displays company> because it is the only element that is appropriate to close. Automatic closing of open tags is part of Stylus Studio's Sense:X intelligent editing. You can change this and other Sense:X options on the Editor General page of the Options dialog box - for example, you can have Stylus Studio display a list of appropriate elements, even if that list includes one only item.
Stylus Studio's Sense:X provides even greater functionality if the document you are editing has either a DTD or XML Schema associated with it. See Sense:X Speeds Editing for more information.
This topic is part of a sequence. If your-quotes.xml is not open, see Opening a Sample XML Document. The sequence starts with Adding Elements in the Text View of a Sample Document.
your-quotes.xml
quote
Alternatives: Press Ctrl+C or click Copy.
</ticker>
Stylus Studio copies the quote element here, but the indentations are not quite right. Instructions for fixing this are in the topic Inserting Indents in the Text View of a Sample Document.
Alternatives: Press Ctrl+V or click Paste. .
Alternative: Press Ctrl+Z.
Alternative: Press Ctrl+Y.
Stylus Studio displays a message that alerts you that there is an open tag for a quote element but no close tag. The messages indicates the line and column in which the error was found.
The Undo and Redo operations are no longer active. After you click the Indent XML Tags button, you cannot automatically undo or redo recent changes. It does not matter whether or not Stylus Studio actually inserts the indents. After you make another change, the Undo operation becomes active again.
Stylus Studio displays the message that indicates that a close tag is missing. It specifies the element name, and the line and column numbers that identify where the error was found.
Stylus Studio moves the cursor so that it appears immediately after the quote tag that has no closing tag.
The current cursor location within the document is displayed as line/column coordinates in the Stylus Studio status bar at the bottom of the Stylus Studio window.
</company>
This time, Stylus Studio correctly indents the XML text.
Indent XML Tags changes your XML document by inserting white space. If this is undesirable, and you want to check for well-formedness, click the Tree tab at the bottom of the XML Editor window. If the document is well-formed, Stylus Studio displays the tree representation. If the document is not well formed, Stylus Studio displays a message that indicates the reason the document is not well formed and the location of the error or omission.
You use the XPath Query Editor to query XML documents using XPath. Stylus Studio supports both XPath 2.0 and 1.0. The default is XPath 2.0.
The XPath Query Editor is a dockable window that appears to the right of the XML document window. If you do not see it, click the Show XPath Query Editor button ( ).
/ticker/quote
Stylus Studio runs the /ticker/quote query on your-quotes.xml, and displays the results at the bottom of the XPath Query Editor window.
In the Text view, Stylus Studio uses its back-mapping feature to move the cursor to the source element for the symbol result element you clicked.
Stylus Studio adds a new tab for each query you define.
//company
Stylus Studio runs the new query and displays the results.
You cannot explicitly delete a query. In addition, queries you define are not saved with an XML document unless that document belongs to a Stylus Studio project - if you close the XML document and then reopen it, the queries you defined in the previous editing session are no longer there.
See Using the XPath Query Editor to learn more about the XPath Query Editor.
See Working with Projects to learn more about projects and their role in Stylus Studio.