Jedit Xml Editor

THDL Toolbox > Developers' Zone > Web-Development > XML Editors > JEdit's XML-Editor

JEdit XML Editor

Contributor(s): Than Grove, …


Setting up jEdit

JEdit is a java-based program and you will need to have a Standard Edition of Java installed and running on your machine. JEdit version 4.2 is the latest stable version. 4.3 is a development version. To use jEdit, you need to have Java installed on your system. Edit 4.3 requires Sun's JDK 1.5.0 or later, while jEdit 4.2 is the last release to support Java 1.3 or 1.4. Once Java is installed you can then install JEdit.

external link: Back to the Top

XML Plug-ins

You will want to install plugins to increase functionality. A full list of external link: plugin downloads. There is also a short list of suggested plugins for a variety of functions on the Quick Start page (scroll down to "Step 3: Get some plugins").

Certain plug-ins are required if you want to use JEdit to edit or create XML files. It is recommended that for serious XML editing one purchase an XML editor, such as oXygen. However, for those wishing to use an open-source editor for XML, JEdit is the best we have discovered. To use JEdit with XML, you will need the following plugins:

  • Error List
  • JTidy
  • XML
  • XSLT

To install these plug-ins, choose Plug-ins > Plug-in Manager. Choose the install tab, locate the plug-ins in the above list, check their boxes, and click on install. You will have to restart JEdit for all the plug-ins to take effect.

external link: Back to the Top

Using jEdit

Some of the most useful features of jEdit are:

  • It can be used for both XML and HTML documents
  • The THDL Windows diacritic keyboard is functional within jEdit
  • Supports UTF-8 and Unicode

external link: Back to the Top

Editing XML

Once the proper plug-ins are installed, one can begin editing XML. The requirements for editing XML are simple. The file must be declared as an XML file and have a DOCTYPE declaration, as is required for most XML documents. Some documents within THDL have had their DOCTYPE declaration commented out for various reasons; if such is the case, it will need to be uncommented out and possibly changed. Without the use of a catalog file, which is somewhat complicated, one must use absolute URLs and the SYSTEM DOCTYPE declaration. If one is going to be working off-line, it is best to download the whole DTD folder from {thdl-root}/xml/dtds/, somewhere onto your hard drive so that the DTDs can be referred to locally. One must use a DOCTYPE such as:


Thought the root element (gdms) and name of the dtd (gdms.dtd) will change for different types of documents. For an essay document, it would be:


Such Doctype delcarations are using a full URL beginning with the "". In general, we are moving away from this practice to use root-relative URLs. This means that one must go up the hierarchy tree using "../" from the location of the XML document to the root level of the site and then into "/xml/dtds/…". Thus, if the GDMS file was for an document in the /reference/typologies/features folder then its Doctype declaration would be:

<!DOCTYPE gdms SYSTEM "../../../xml/dtds/gdms.dtd">

This is assuming that you have a mirror version of the THDL site on the computer which is editing the XML document. At the very least, the XML document being edited must be in the same folder structure and in the same position relative to the DTD. For instance, on my computer, I have a folder, C:THDLthdl-site, in to which I check out the THDL web files from the SVN repository. I have not checked out all of them but a large portion of them. Thus, I have a file called "thdl-features.xml" located at: C:THDLthdl-sitereferencetypologiesfeatures, and the "gdms.dtd" it calls is located at: C:THDLthdl-sitexmldtds.

Note for project workers: If you are working only on one specific project within THDL and/or for a relatively short period of time, you may not wish to set up a whole mirror version of the THDL website locally just in order to validate and edit XML documents. In such cases you should change the Doctype to for instance:

<!DOCTYPE gdms SYSTEM "/xml/dtds/gdms.dtd">

You will then need to create a folder at the root level of your hard drive called "xml" and within that a sub-folder called "dtds" in which all the necessary DTDs should be placed. Of course, the name of the DTD (in this case, "gdms.dtd") should not be changed.


<!DOCTYPE TEI.2 PUBLIC "-//THDL//DTD TEI-Based Tibetan Doc v2.0//EN" "xtib2.dtd">

Such DOCTYPEs should be changed to SYSTEM identifier-based ones.

external link: Back to the Top

Validating XML Files and Auto-Complete

If JEdit recognizes the document as XML and can read the DTD, then it will provide you with automatic validation. If there is an XML error in the document, a red line will appear in the vertical bar next to the scroll bar, as shown in the image below. Placing the cursor over the red line will provide a description of the error in terms of the DTD:

XML Error Locator on Side-bar in JEdit

If you click on that red line, it will take you directly to the error, which will be underlined in red, as in the image below. Hovering over the error will provide you with a somewhat cryptic description of the error.

An XML error displayed in the JEdit Text Editor

Also, when you begin to add an element to an XML document by typing a "<", JEdit will provide you with a list of options to choose from, which are valid insertions at that point. An example is depicted below:

An example of JEdit providing a list of possible insertions in an XML file

external link: Back to the Top

Useful Links

Installation instructions for individual operating systems are available on the download page.

external link: Back to the Top

Provided for unrestricted use by the external link: Tibetan and Himalayan Digital Library