5.1. The "XML source" menu item

This menu item is available only when the "Edit source" add-on has been installed.

The "Edit source" add-on adds an "XML Source" item at the end of the View menu. Selecting this item replaces the current styled or tree view by a source view of the document being edited.

The source view of a document shows the contents of the save file which would be created by XXE for this document (same automatic indentation, same named character entities, etc).

The source view of a document embeds an advanced text editor having the following capabilities.

Limitations:

In addition to the keyboard shortcuts found in all text editors, the source view also supports the following shortcuts:

Keyboard ShortcutDescription

Ctrl+SPACE

(Ctrl even on the Mac)

Auto-completion for element names, attribute names, attribute enumerated values and named character entities.

Element names

Type '<' then press Ctrl+SPACE.

Attribute names

Press Ctrl+SPACE inside an open tag (e.g. after foo inside <foo ...>).

Named character entities

Type '&' then press Ctrl+SPACE.

Ctrl+F

(Cmd on the Mac)

Find.

Press Ctrl+Shift+F to find backwards.

Ctrl+G

Find again.

Press Ctrl+Shift+G to find again backwards.

Ctrl+M

Replace.

Press Ctrl+Shift+M to replace backwards.

Ctrl+Shift+L

Goto line.

[Important]The source view is not “synchronized in real-time” with the other views of the same document

Being an (almost) normal view of an XML document, it's possible to use ViewMultiple ViewsAdd View to have, for example, the styled view of a document and its source view side by side.

However, while all the tree and styled views of a document are “synchronized in real-time” (that is, reflect the same document content in real-time), this is not the case of the source view. For performance reasons, you'll have to save the document to disk (or at least check the document for validity) to synchronize a source view with the other views.

For example, if you click in the styled view of a document (left side in the above figure), modify it and save the document to disk, the source view of the document will be automatically updated. Note that if before doing that, the source view was modified, you'll loose these unsaved changes.

Conversely, if you click in the source view of a document (right side in the above figure), modify it and save the document to disk, the styled view of the document will be automatically updated. Note that if before doing that, the styled view was modified, you'll loose these unsaved changes.

In a nutshell, if you use the styled view of a document side by side with other views, always remember to save your document to disk (Ctrl+S; or at least check the document for validity: Ctrl+Shift+V) before switching from one view to an other.