XML Editor

The XML Editor service is a text-based XML editor and can be used to edit XML Documents in the XNGR XML Browser application. The editor has all basic functionality needed for a XML Editor. Besides the normal editing actions like Cut, Copy, Paste, Find, Goto and Undo/Redo, it also supports any documents encoded in UTF-8, syntax highlighting, automatic tag completion and indentation, block indentation and the XML Document can be validated against a XML Schema or DTD.

Editor Screen-shot

Features

Tag Selected Text    (Ctrl-T)

To set tags around selected text, invoke the Tag... option, this will open a dialog which allows you to set a name for the tag.

Comment Selected Text    (Ctrl-K)

To comment-out text, select the text you want to comment and invoke the Comment option.

Format Document    (F4)

The document can be formatted by using the Format option. The XML Document has to be well-formed or valid for the formatting option to work. The formatting style can be changed in the preferences to allow for indentation of elements with mixed content.

Indent Mixed Content:

<text>
  This 
  <i>text</i> 
  gives an example of what happens when the 
  <b>Indent Mixed Content</b>
  preference is enabled.
</text>
Do not Indent Mixed Content:
<text>
This <i>text</i> gives an example of what happens when the
<b>Indent Mixed Content</b> preference is not enabled.
</text>

Automatic Tag Completion

This feature automatically creates an end-tag after a start-tag has been entered. Automatic tag completion can be turned off in the preferences.

Block (Un)Indentation    ((Shift)-TAB)

Block Indentation, indents or unindents a line or selected lines by a number of spaces. The number of spaces for (un)indentation can be set in the preferences.

Automatic Indentation

Automatically indents the next line.

Validate against a DTD

Validate the XML against the defined DTD.

To validate against a DTD, the DTD needs to be defined in the document using the DOCTYPE element, like this:

<!DOCTYPE test PUBLIC "http://test.org//1.0" "http://test.org/test.dtd">

Validate against a XML Schema

Validate the XML against the defined XML Schema.

A Schema can be defined in XML like this for a Schema without namespaces:

<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="http://test.org/test.xsd"/>
like this for a schema with namespaces:
<test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://test.org/test.xsd"
    xmlns="http://test.org/"/>

Well-Formed XML

A well-formed XML document is a XML document that has matching start- and end-tags or correct empty-element tags and no overlapping markup. Well-formedness does not check for any rules as identified by the associated DTD or Schema and needs all entity references to be resolved. The XML Editor has an extended set of common built-in entities, this set is used when checking for well-formedness. So the parser will not complain when it encounters any of the following entities: &copy;, &euro;, &quot; etc...

To check for well-formedness, make sure the Valid option is disabled when parsing the document.
Note: A document is also parsed when saved and formatted.

Valid XML

A Valid XML document is a well-formed XML document that is validated against the rules defined by the associated DTD or Schema and needs all entity references to be resolved. The extended set of common built-in entities, is not used for validation, so all entity references need to be defined in the associated DTD.

To Validate an XML Document, make sure the Valid option is enabled when parsing the document.
Note: A document is also parsed when saved and formatted.