6

Trying to validate an XML document; however, xmllint is insisting on reading the options as the file so I'm getting FileNotFound exceptions. Just to confirm, I have the xmllint.exe in the same folder as my XML file. I locate the directory in CMD and enter the command:

xmllint --noout --valid file.xml

The DTD is located within the xml file. However, xmllint is looking for the file ~/--nout. I have tried putting the file before the options, however, the options are then not applied. I'm relatively new to this, so I have no doubt the problem is obvious.

Thanks in advance.

EDIT: Here is a screenshot of it refusing to work >:(

Screenshot depicting the file not found exception

JohnW
  • 345
  • 1
  • 7
  • 15
  • Are you copying/pasting anything on the command line? Make sure your dashes are actually dashes. (Your command line looks fine though and it should work.) – Daniel Haley May 11 '13 at 04:47
  • @DanielHaley I am not copying anything; and yes, they are the correct dashes. Any other possibilities? – JohnW May 12 '13 at 03:58
  • 1
    Even if I try just `xmllint --version` xmllint still tries to find `~/--version`? – JohnW May 12 '13 at 04:01

1 Answers1

13

I am pretty sure that you aren't using xmllint, but another program with the same name.

I suspect that you are trying to use http://code.google.com/p/xmllint/. With it, I can reproduce your error message. The only thing that this program can do is to pretty-print the input file.

The real xmllint for Windows is available at http://www.zlatkovic.com/libxml.en.html. Download libxml2-2.7.8.win32.zip, iconv-1.9.2.win32.zip, and zlib-1.2.5.win32.zip from the download area. Put the contents of the "bin" directory of each package in a single place. Read the "Getting The Binaries" and "Installing" sections for details.

mzjn
  • 48,958
  • 13
  • 128
  • 248
  • The Windows binaries site is unreachable for me, so i built [a wrapper for the Node version.](https://github.com/kripken/xml.js/issues/11#issuecomment-190661196) – Cees Timmerman Mar 01 '16 at 12:53
  • I have scripted the `xmllint` installation using PowerShell in a gist here: https://gist.github.com/mavaddat/f021e09f8c2d492e19959a9978b42544 – Mavaddat Javid Mar 10 '23 at 19:53