In this post I describe how to add an editor to edit and verify XML files. I use that for ARM CMSIS-Pack XML files with NXP Kinetis Design Studio, but the steps are applicable to any Eclipse or any kind of XML editing.
Adding XML Editor to Eclipse
I’m using Eclipse Mars and Luna. The easiest way to get XML capabilities is to to install the “Eclipse XML Editors and Tools“. Use the standard Eclipse update site (e.g. luna or mars) for your Eclipse distribution. The XML editor is under ‘Programming Languages’. Screenshot shown for NXP Kinetis Design Studio (Luna based):
:idea: You can filter the entries for ‘xml’ as I did in the screenshot below.
Then go through the installation process with ‘Next >’.
Make sure you have the PACK.xsd (XML Schema Definition) file present in the root of the pack:
The PACK.xsd file is part of ‘CMSIS’ Pack and e.g. can be found here (using version 4.5.0 inside the Keil installation:
Or the place where you have installed the packs with the GNU ARM Eclipse Pack manager:
With the XML editor installed I can double-click on that .xsd file and get a nice schema definition viewer:
Trying to do the same with the .pdsc gives me this dialog as the extension is not a usual XML file extension:
Clicking on that link in the dialog gives me a dialog where I can add the *.pdsc extension to be handled as XML:
Next I have to add a file association:
Now I can directly use the XML editor for CMSIS-Pack .pdsc files:
Now I have a graphical editor for my file: I can switch between the ‘Design’ and ‘Source’ view:
And best of all: I can now validate my XML files with the Schema Definition File (*.xsd):
And it shows me that I have a problem with my XML file (ups!):
So now I have to fix that issue…
Eclipse is a very versatile IDE and environment: for pretty much everything you can imagine there is a plugin. Of course as well for something for XML editing. The XML support is not included in the normal Eclipse CDT distribution for C/C++ development, but can be easily added. That way I can now produce better CMSIS-Pack files :-).
Happy XMLing :-)