A very simple XML file (which also happens to be an edit mode) looks like so:
<?xml version="1.0"?> <!DOCTYPE MODE SYSTEM "xmode.dtd"> <MODE> <PROPS> <PROPERTY NAME="commentStart" VALUE="/*" /> <PROPERTY NAME="commentEnd" VALUE="*/" /> </PROPS> <RULES> <SPAN TYPE="COMMENT1"> <BEGIN>/*</BEGIN> <END>*/</END> </SPAN> </RULES> </MODE>
Note that each opening tag must have a corresponding closing tag.
If there is nothing between the opening and closing tags, for example
<TAG></TAG>, the shorthand notation
<TAG /> may be used. An example of this
shorthand can be seen in the
Most XML file formats have a formal grammar specified in either DTD, XSD or RNG.
In the example above, we can see that the
or formal grammar for jEdit mode files is described in
which happens to come from jEdit's source code.
If you install the XML plugin, and while editing a mode file in jEdit, go to
you should see a structure tree in Sidekick,
and you will also see errors (if there are any) in ErrorList, if the document does not
conform to the proper XML syntax or the document's formal grammar.
In addition, the XML plugin provides completion tips for elements and attributes.
All of these things can help immensely especially when learning XML.
It is highly recommended that you check your XML files for validation errors before submitting them to the community.
XML is case sensitive.
span is not the same as
To insert a special character such as < or > literally in XML (for example, inside an attribute value), you must write it as an entity. An entity consists of the character's symbolic name enclosed within “&” and “;”. The most frequently used entities are:
< - The less-than (<)
> - The greater-than (>)
& - The ampersand (&)
For example, the following will cause a syntax error:
Instead, you must write:
Now that the basics of XML have been covered, the rest of this section will cover each construct in detail.