Using Notepad++ to edit and check XML files

 This article is suitable for a Library Administrator

Ref: 201412121205
Last Edited: July 1st, 2015


We know that some struggle to maintain, for example, the ‘flash-menu.xml’ files that define the menus on a process library site’s homepage; even though XML is a text format, not everyone is comfortable editing it.

Notepad++ is a free text editor with extensive enhancements in comparison to Microsoft’s Notepad, included in Windows.

Notepad++ can help by colour-coding an XML file’s content for easier readability, and with the numerous features of its XML Tools plugin.



Installing the XML Tools plugin

Using Plugin Manager

  1. Run Notepad++.
     
  2. Click 'Plugins' > 'Plugin Manager' > 'Show Plugin Manager'.
     
    Available plugins not already installed should be listed on the 'Available' tab.
     
  3. Tick the 'XML Tools' check box, and click 'Install'.
     
  4. When prompted, choose to restart Notepad++.
     
  5. If warned about the version of the plugin updater, just click OK.
     
  6. Check that 'XML Tools' is available from the 'Plugins' menu.


Manual installation

If installing through Plugin Manager isn't successful, manual installation is simple.

Download the files by clicking on the 'XML Tools' link here:

The ZIP will contain these files:

ext_libs\
  iconv.dll
  libxml2.dll
  libxslt.dll
  zlib1.dll
XMLTools.dll

These need to be copied to the Notepad++ installation.

C:\Program Files (x86)\Notepad++\
  plugins\
    XMLTools.dll
  iconv.dll
  libxml2.dll
  libxslt.dll
  zlib1.dll
 

Working on XML files in Notepad++

Colour-coding

When an XML file is open in Notepad++, if not already, apply colour coding:

‘Language’ > ‘XML’

<?xml version="1.0"?>
<menu name="links">
<menu name="Level 1 - Sample 1">


Checking syntax

Check the XML syntax:

 ‘Plugins’ > ‘XML Tools’ > ‘Check XML syntax now’

For example, a homepage that doesn’t display a menu suggests an error in the XML of the site’s ‘flash-menu.xml’ file.
 

Applying ‘Pretty print’ layout

‘Pretty print’ will lay out the XML with indenting to reflect the XML structure, making it more readable and easier to understand.

‘Plugins’ > ‘XML Tools’ > ‘Pretty print (XML only – with line breaks)’

Note that this is a change to the file, adding extra whitespace, unlike the application of colour-coding, which is just a different way of presenting the content.



These are just some of the features of Notepad++ that can facilitate the maintenance of text files, such as XML files. There are so many more, which makes it a very popular utility here at Triaster, and indeed with many of our customers.






Need further help? Contact the Triaster Support team by e-mailing support@triaster.co.uk or by calling us on + 44 (0)870 402 1234.
 
Do you have any feedback or suggestions that you would like to share with Triaster? We would love to hear from you! Please e-mail feedback@triaster.co.uk