I've always found validation against a schema to be an invaluable ward against thinkos and would like to incorporate validation checks as part of a project where I frequently need to hand-write XML files a few hundred lines in length. My text editor has a fairly nice CLI integration feature, so I'm looking for a command-line validator.
When I didn't find any clear winners via Google, I poked around here and found a similar question, but none of the tools suggested there quite fit my needs:
- libxml (via cygwin) — does not report line numbers; I have no idea where my errors are!
- msxml — cannot be run from the command line?
- xerces-c — seems to require a copy of Visual C?
- xerces2-j — cannot be run from the command line?
- xmlstarlet — insufficient XSD support*
(*The schema I'm validating against uses substitution groups — inappropriately, but it's external to the project, so I can't change it — which causes xmlstarlet
to choke even on valid files.)
Normally, this is the point in solving a problem at which I'd give up on looking for an existing solution and reach for the Python-hammer, but Python's XML support is notoriously… well… actually, let's just leave it at "notorious".
So I'm back to looking for a pre-existing tool. My requirements are pretty simple:
- runs on Win32 (Windows XP SP3, specifically)
- command-line; my editor can work with just about any combination of stdin/-out/-err, arguments, temp files, etc.
- reasonably complete XSD support (particularly namespaces and substitution groups)
- reports the line number where the error occurred!
Does such a tool exist? I'd prefer not to have to install Visual Studio and friends (too bloated, IMO), but I do already have both Cygwin and Python installed.