Chapter 4. Editing Documents

Table of Contents

Editing Preferences
Syntax Highlighting
Editing Font
Editor Formatting Preferences
Printing Scale
Code-Insight Configuration
Working with Documents
Creating New Documents
Opening, Saving and Closing Documents
Creating Documents based on Templates
Creating New Templates
Sharing Templates
Editing Documents
Debugging Your Documents

This chapter explains how to create, edit and manage files as part of a project within the oXygen XML Editor.

Editing Preferences

oXygen enables a high-level of customization to the way in which text is displayed, managed and edited.

The oXygen Editor is not a WYSIWYG or quasi-WYSIWYG editor. The reason for this is that the principle of single-source, or structured mark-up, detaches content and presentation layers. This enables a greater degree of flexibility and interchange between applications by enabling the preparation of multiple target ready content. Each format defines its own presentation layer using one or more viewer technologies suitable for delivery across a variety of applications, such as Web Browsers, Cellular Phones, Interactive Voice Response and Speech Recognition systems.

When using oXygen it is therefore helpful to keep in mind that format and layout are controlled by a style sheet that applies the final formatting and layout during the transformation phase. Formating under the editor is therefore only for the purpose of optimizing the editor space and increasing convenience while editing.

Syntax Highlighting

Syntax Highlighting promotes easier readability by applying colors to the mark-up tags. Syntax Highlighting not only enables you to distinguish mark-up from content, but also highlights differences between tag types and their attributes. The oXygen XML Editor supports syntax highlight for XML, DTD, Java, C, C++, SQL, PHP, Perl, Properties, Shell and Batch.

While oXygen provides a default color configuration for highlighting the tokens, you may choose to customize, as required, using the Colors dialog.

Open the Colors dialog by selecting Options->Preferences->Colors option. .

Color profiles for Syntax Highlighting are stored according to Document Types. When selecting a document type will appear a list of tokens with the default colors values. Selecting a token displays a dialog were the color properties can be changed. Use Swatch, HSB or RGB models to define the color properties.

Complete the dialog as follows:

Swatches

Displays a color pallet containing a variety of colors from across the color spectrum and shades thereof. Select a color.

HSB

Hue, Saturation and Brightness (HSB) enables you to specify a color by describing it using hue, saturation and brightness.

RGB

Red, Green and Blue (RGB) enables you to specify a color using triplets of red, green and blue numbers.

Preview

Displays the color properties of the current token and results of customization.

Modifications are saved when the Apply or OK button is clicked. Cancel discards changes.

Editing Font

oXygen enables custom selection of the font-type and size used in the Editing Space by means of the Editor Font dialog.

Open the Editor Font dialog by selecting Options->Preferences->Editor->Font option.

Figure 4.1. The Editing Font Dialog

The Editing Font Dialog

Complete the dialog as follows:

Font Family

Displays the list of fonts installed on the system environment. Click the drop-list to view and select a font type.

Font Size

Increments or decrements font size in points.

Sample

Displays a preview of the selected font and size.

Modifications are saved when the OK button is clicked. Cancel discards changes.

Editor Formatting Preferences

Text layout, formatting preferences and behavior can be customized using the Editor option from the Preferences dialog.

Select the Editors option in Options->Preferences.

Figure 4.2. The Editor option

The Editor option

Complete the dialog as follows:

Line Wrap

Enabling this option will wrap lines automatically in the edited documents so that all the characters on a line fit in the displayed window.

Show EOL/EOF marks

Marks the EOL and EOF characters with a graphical symbol for a easier visualization.

Show line numbers

Displays the line numbers on the left part of the editing space.

Indent Size

Sets the number of spaces or the tab size that will equal a single indent. The Indent can be spaces or a tab, select the preference using the Indent With Tabs option. If set to 4 one tab will equal 4 white spaces or 1 tab with size of 4 characters depending on which option was set in the Indent With Tabs option.

Line Width - Pretty Print

Defines the point at which the “Format and Indent” (Pretty-Print) function will perform line wrapping. So if set to 100 Pretty-Print will wrap lines at the 100th space inclusive of white spaces, tags and elements.

Indent With Tabs

When checked enables 'Indent with tabs' to sets the indent to a tab unit. When unchecked, 'Indent with tabs' is disabled and the indent will measure as many spaces as defined by the 'Indent size' option.

Smart Indent

Smart Indent attempts to indent mark-up in accordance to the tag/text and its position/context within the body of a document. This option either enables or disables the use of smart indenting.

Enable Automatic Save

Enables automatic save of the edited document at time intervals set by the next option.

Automatic Save Intervals

Sets the time interval between automatic saves.

Modifications are saved when the OK button is clicked. Cancel discards changes.

Printing Scale

It is sometimes useful to print out the contents of a document on paper. oXygen allows you to adjust the scale of the print output to make it easier to read on a page.

Open the Print Scale dialog by selecting Options->Preferences -> Print.

Figure 4.3. The Printing Scale option

The Printing Scale option

Code-Insight Configuration

The Code-Insight feature enables in line syntax lookup and Auto Completion of mark-up elements and attributes to streamline mark-up and reduce errors while editing.

The Code-Insight feature is populated by the elements and attributes supplied by a specified DTD or XML Schema defined by the System Identifier in the Document Type Declaration. The absence of a System Identifier would therefore depreciate the functionality of the Code-Insight feature, resulting in the display of an incomplete or non accurate element and attributes list. As not all XML documents are required to have a System Identifier, oXygen provides a method to specify a DTD or XML Schema within the application. When Code-Insight detects that the a document does not have a System Identifier declared, it will default to using the DTD or XML Schema specified within the Code-Insight Configuration dialog. Before starting work it is recommended that you configure Code-Insight with your personal preferences using the options provided.

Specification of DTD or XML Schema and behavioral settings of the Code-Insight assistant are configured via the Code-Insight option from the Preferences dialog.

Figure 4.4. Code-Insight - Features option

Code-Insight - Features option

Complete the dialog as follows:

Use Code-Insight

Enables/disables all the Code-Insight options.

Close the Inserted Element

When inserting elements from the Code-Insight assistant, both start and end tags are inserted.

Add required elements

When inserting a new element oXygen will add automatically the required elements inside the new element, specified in DTD or XML Schema file.

End Tag Auto Completion

Having manually typed the start tag of an element, oXygen will automatically insert the ending tag when </ is typed.

Insert the Required Attributes

When inserting an element from the Code-Insight assistant, the cursor is automatically positioned before the > bracket of the start tag. Entering a space displays the attributes supported by the inserted element.

Figure 4.5. Code-Insight - XML option

Code-Insight - XML option

Complete the dialog as follows:

DTD

Used to specify the full path location of the DTD file that will be used to initialize the Code-Insight assistant when a document does not define a DTD or XML Schema.

XML Schema

Used to specify the full path location of the XML Schema file that will be used to initialize the Code-Insight assistant when a document does not define a DTD or XML Schema.

Figure 4.6. Code-Insight - XSL option

Code-Insight - XSL option

Complete the dialog as follows:

None

includes none of the elements declared in the schema

XHTML Transitional

includes XHTML Transitional elements declared in the schema

Formating Objects

includes Formating Objects elements declared in the schema

Other

includes elements from a DTD file or a XML Schema file specified from a URL

Modifications are saved when the OK button is clicked. Cancel discards changes.