XML Formating and Indentation.
Smart Indenting
When editing content with <oXygen/> the document will lay out nicely while you
edit it just like after a pretty print operation. For instance when you press Enter
after an element the content cursor will perform an indent on the next line. If you
press Enter after a closing tag it will be automatically aligned with the
corresponding start tag.
Formating and Indenting Documents
Although writing documents with no indentation is a perfectly acceptable practice,
it makes editing difficult and is error prone. It also makes the identification of
exact error positions difficult. Formatting and Indenting, also called "Pretty Print",
enables the XML documents to be neatly arranged in a manner that is consistent and
promotes easier reading.
Pretty-print for HTML documents handles scripts and styles
Usually an HTML document contains scripting and style
information. The format and indent operation that applies to HTML text content is not
suitable for formatting scripts and CSS styles. Therefore <oXygen/> detects these
sections and automatically pretty-prints the embedded JavaScript and CSS sections
using the JavaScript and CSS formatting options.
Format and Indent Preferences
XML documents can be formated and indented with the following options. You can
specify the indent size, the maximum line length and if spaces or tab should be used
for indenting.
To control the elements that should not be processed you can use the xml:space
attribute and specify its value to "preserve" or "default"
depending on whether you want to keep the text content unchanged. Another way is to
edit the two lists of elements that will be treated as if they have an xml:space
attribute with the value "preserve" and "default" respectively.
Advanced options allows you to sort the attributes or keep their document order and to
output empty elements as empty tags or as start and end tag.
Indent Selection
This is a light alternative to the pretty print operation. After you select a
region of text you can choose this option to indent the selected lines. The indenting
will not perform any hard wrapping, only the white spaces at the beginning of each
line will be affected by inserting or removing other whitespaces so that the lines
will be indented. The action is available in the contextual menu.
XML Source Hard Wrap
This feature saves time when writing an XML document with a lot of text content.
You can set a limit for the length of the lines in your document using the line width
formatting option. When this limit is exceeded the editor will insert a new line
before the word that breaks the limit, and indent the next line. This will minimize
the need of reformatting the document. You can activate this feature from the
options.
Auto-detect the XML Formatting Settings
The editor tries to detect the indent settings (indent size, indent with tabs or
spaces) of the opened XML document. That allows to correctly format (pretty-print)
files that were created with different settings, without changing your options. More
than that you can activate the advanced option for detecting the maximum line width to
be used for formatting and hard wrap. These features were designed to minimize the
differences created by the pretty print operation when working with a versioning
system, like CVS for example.
The two options are "Detect indent on open" and "Detect line width on open" from
the above dialog.
Indent on Paste
The editor indents the pasted text sections. This speeds up the editing and keeps
the document formatted. It is activated by default.
|