Using Notepad++ to validate XML against an XSD
Asked Answered
G

2

151

Can someone explain how to use Notepad++ to validate an xml file against an xsd. There are no options in the "XML Tools" plugin dropdown that provides for specifying an XSD file. The XML plugin is installed properly in the plugins subdir and the 3 DLLs are copied to the Notepad++ EXE subdirectory. Other XML "validation" features work but there is no way to validate against an XSD.

Gisarme answered 15/3, 2013 at 15:29 Comment(7)
i've seen several references (and screenshots) of specifying an XSD to validate an XML file - using Notepad++. for example michigan.gov/documents/cepi/…Gisarme
Have u looked at when-others-then-null.blogspot.co.uk/2012/12/… It seems it contains what you need.Disaster
Using the exact XML & XSD from this example worked and i realized what i was doing wrong. I didn't realize that the {xsi:schemaLocation="foobar.com/invoice invoice.xsd"} was actually reading the XSD from my hard drive from the same subdir as the XML file and validating. Thanks.....Gisarme
@Shmil The Cat: How to against a dtd.Reggiereggis
@ShirgillAnsari - For DTD validation the XML must contain the DOCTYPE specifying the DTD in the same directory as the XML. like: <!DOCTYPE XML_ROOT_NODE SYSTEM "thisXMLusesThis.dtd"> then the tool can figure it out.Anticipative
Just an FYI, if you use nested schemas and refer other schema using relative path such as foo\abc.xsd, make sure that you use forward slash(/) instead of backward slash (\) when validating in NPP Xml Tools plugin. If you use backward slash, it gives schema parsing error but forward slash works fine.Gruber
The dialog seems no longer to exist. In XML Tools Plugin 2.4.9.2 it will not be displayed.Cliquish
B
168
  1. In Notepad++ go to Plugins > Plugin manager > Show Plugin Manager then find Xml Tools plugin. Tick the box and click Install

    enter image description here

  2. Open XML document you want to validate and click Ctrl+Shift+Alt+M (Or use Menu if this is your preference Plugins > XML Tools > Validate Now).
    Following dialog will open: enter image description here

  3. Click on .... Point to XSD file and I am pretty sure you'll be able to handle things from here.

Hope this saves you some time.

EDIT: Plugin manager was not included in some versions of Notepad++ because many users didn't like commercials that it used to show. If you want to keep an older version, however still want plugin manager, you can get it on github, and install it by extracting the archive and copying contents to plugins and updates folder.
In version 7.7.1 plugin manager is back under a different guise... Plugin Admin so now you can simply update notepad++ and have it back.

enter image description here

Bioastronautics answered 11/5, 2015 at 12:19 Comment(7)
Plugin manager is added back now in the latest releases of Notepad++, it is now called as Plugins Admin...Sumerlin
@Šaikat Thanks for update mate, added to the question.Bioastronautics
This is magnificent and a decent solution. This should be added as a solution.Besetting
Thank you. Is there a way to check validation errors one by one? Right now I have to fix one, save it and re-run the XSD again :(Entity
If you are trying to validate web.confg. Needs .xml extension. Didn't work for me with web.config. So I renamed it to web.config.xml.Dymphia
Notepad++ v8.4.7 (64-bit) here. No plug-in manager, or plug-ins admin. This worked: 1) Download XML tools: github.com/morbac/xmltools/releases 2) Create an "XMLTools" folder (no spaces) in the appropriate 32 or 64 bit program files folder, e.g.: C:\Program Files\Notepad++\plugins\XMLTools (I needed $#%&*@#$ admin permissions to do that.) 3) Place the XMLTools.dll in the XMLTools folder. 4) Import the XMLTools.dll plugin: Settings>Import>Import plugin(s)... 5) Close Notepad++ (if it was running). Re-open Notepad++. 6) Navigate to the XML tools plug-in: Plugins>XML ToolsLaid
Do you have any suggestion to validate an XML vs a DTD (and not XSD)? It worked with older version of Xml Tool plugin, but it doesn't work with the current one.Antifebrile
W
0

First, open your notepad++. Go to Plugins -> XML Tools. Uncheck the Enable auto-validation.

Worldwide answered 2/4 at 7:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.