So far, the XML files I had to work on were very simple ones, so a normal text editor was fine. Now I’m tapping into the world of CMSIS-Packs (see “Are ARM CMSIS-Pack the Future of Software Components?“). And definitely this adds a complexity for which I better use some XML editing and checking tools. The ARM tutorial for CMSIS recommends either Notepad++ or Visual C++. But hey, Eclipse should be able to do that maybe even better right? So this is about adding an XML editor and XML checker to Eclipse.
Outline
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):
💡 You can filter the entries for ‘xml’ as I did in the screenshot below.
Then go through the installation process with ‘Next >’.
CMSIS-Packs
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:
<Keil MDK>\ARM\Pack\ARM\CMSIS\4.5.0\CMSIS\Utilities
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 as well 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 problem with my XML file (ups!):
So next I have to fix that issue…..
Summary
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 🙂
Pingback: Are ARM CMSIS-Pack the Future of Software Components? | MCU on Eclipse