XML Development Tools
For the enterprise XML developer who needs the most advanced XML, XBRL, Web services, stylesheet design, data integration, and chart creation capabilities, plus additional support for XML-aware file/directory differencing and merging, advanced XML-based file management, and Semantic Web development. A multitude of XML plug-ins have been developed, and new ones are created all the time. This article focuses on the plug-in called XMLBuddy, because its feature-rich set contains most of the functions needed for XML document development. We do touch on other plug-ins when they provide a richer set of user options for specific tasks. This article will familiarize you with the basic XML editing features, but bear in mind that Eclipse is a dynamic frameset that puts an endless array of tools and features at your fingertips.
The Eclipse XML editor
Eclipse already includes source code for a very primitive XML editor that offers only XML syntax highlighting. It extends classes included in the org.eclipse.ui.editors package, which provides a standard text editor and a file-based document provider for the Eclipse Platform. This simple XML editor serves as a code example that you can use as a base for your own Eclipse XML plug-ins. Its source code can only be generated from the Eclipse project wizard, and you will need to compile it yourself as described here.
To build this basic XML editor, go to the menu File => New and select Project. In the project wizard, select Plug-in Development => Plug-in Project.
If you don’t see the Plug-in Development option, it means that you have the Eclipse Platform Runtime Binary without the Plug-in development environment. Go to the eclipse.org downloads page (see Resources later in this article for a link) and download the Eclipse Platform Plug-in SDK.
Click Next. Give your project a name, such as org.my.eclipse.xmleditor, click Next, and accept the default values on the screen Plug-in Project Structure. Now select the Create a plug-in project using a code generation wizard and the Plug-in with an editor options. The wizard automatically generates the source code for the XML editor.
You still need to compile it, though. Click Next and then the Finish option on the next screen Simple Plug-in Content; go to the Project menu and select Rebuild All to build the project.
Now you need to create the editor.jar file using the File => Export menu. Exit Eclipse and copy the whole org.my.eclipse.xmleditor plugin directory. When you run Eclipse again, you can add an XML file to your project and see how XML syntax highlighting works (see Figure 1). Remember that this sample XML editor doesn’t offer any kind of validation or syntax checking.