51

I needed help installing xmllint from this website: http://xmlsoft.org/sources/win32/

In particular, I am not sure which file I am supposed to download - when I click the link for precompiled Windows binaries I am brought to a list of several files and not sure how to proceed.

sgx
  • 1,265
  • 3
  • 19
  • 36
  • 1
    This question appears to be off-topic because link mentioned in the question describes how the dependancies work and an answer would simply be reproducing that. – Quentin Oct 23 '13 at 16:14
  • Re edited question: Follow the *other* link to the Windows binaries page: http://www.zlatkovic.com/libxml.en.html – Quentin Oct 23 '13 at 16:14
  • 2
    Hmm...I have downloaded and unzipped the relevant files. But when I try running xmllint.exe it says that I don't have iconv.dll which I do have (and unzipped). Could you advise further? – sgx Oct 23 '13 at 18:11
  • More basically how could I edit XML data with DTDs? – sgx Oct 23 '13 at 19:06

7 Answers7

72

I had the same problem and it took me two hours to make it work.

  1. Download iconv, libxml2, libxmlsec, and zlib from [ftp://ftp.zlatkovic.com/libxml/][1]
  2. Extract the zip file then copy all the files in the bin folder of each download.
  3. Paste the files in a folder (mine = XML)
  4. Add the C:\folderName (mine = C:\XML) in the path system variable. (I'm using Windows 8, for Windows 7 users here's a link):
    • Windows key + r (run window)
    • Type control panel then press Enter.
    • Type path in search box.
    • Under System, click "Edit the system environment variables".
    • Under the Advanced tab, click "Environment variables".
    • In the System variables look for Path → Edit → add ;C:\folderName,
    • or just type path in search box located in your Windows 8 charms.
  5. Make it work (I only type xmllint and I had no idea why I cant see the xmllint window. This is a note for beginners)
    • copy a xml file into the xmllint directory

    • type xmllint --valid --noout fileName.xml.

      If you get this message:

      warning : failed to load external entity "fileName.xml"

      then that's likely a bug so download an older version of libxml2 from http://xmlsoft.org/sources/win32/ or assign another folder to your XML files and run xmllint from there.

      In the command window :

      • cd C:\Users\user name\Documents\XML files.
      • Once you're inside it, type the xmllint commands e.g. xmllint --valid --noout fileName.xml).

Reference:

double-beep
  • 5,031
  • 17
  • 33
  • 41
rsano
  • 1,230
  • 1
  • 12
  • 19
  • hi how to make it work for bulk files, when I am trying to replace html content in `
    and <\div>``--output oldfileName+New.Html`
    – Transformer Jan 27 '17 at 21:06
  • Thank you very much! Still works in 2022 for the WIN32 files. I did not try to get the 64-bit files to work. I am using to validate XML with XSD schema using `xmllint --schema my_schema.xsd my_file.xml --noout` – Big Al Oct 10 '22 at 19:14
  • In case it helps anyone else, I have implemented the above steps as a PowerShell script here: https://gist.github.com/mavaddat/f021e09f8c2d492e19959a9978b42544 – Mavaddat Javid Mar 10 '23 at 19:14
32

For users of Chocolatey, installing xmllint is rather simple:

choco install xsltproc

This package contains the xmllint, iconv, xmlcatalog, and xsltproc commands, and any dependencies are installed automatically.

Andreas Maier
  • 2,724
  • 1
  • 26
  • 30
  • Genious. Side note: `xmllint` did not exactly work as supposed until I started to use it inside the (Git) Bash. – wp78de Dec 16 '20 at 15:58
21

On Debian/Ubuntu-derived distributions, xmllint is part of the libxml2-utils package.

To install:

sudo apt install libxml2-utils

On RedHat-derived Linux distros, xmllint comes in the same package as the library itself, so it's very likely you already have it.

TheDudeAbides
  • 1,821
  • 1
  • 21
  • 29
Erik Stabij
  • 319
  • 2
  • 2
  • This was a helpful answer to me, but the original question pertains to Windows. Even so, I've submitted an edit to note that this is Debian/Ubuntu-specific. On RedHat/CentOS, the `xmllint` binary is in the same package as the library (libxml2), so you probably already have it. – TheDudeAbides Apr 09 '23 at 14:12
5

It is true that xmlsoft.org does not have much information about how to install xmllint in Windows.

Perhaps (as already suggested by Quentin in a comment) the information at http://www.zlatkovic.com/libxml.en.html will help you.

C. M. Sperberg-McQueen
  • 24,596
  • 5
  • 38
  • 65
1

The link from C.M. Sperberg-McQueen is a good starting point. You need to 1) download the libxml2 package, and 2) place the bin folder that comes with this in a directory contained in your PATH environmental variable.

If you don't know how to figure out which directories are in your PATH environmental variable follow this: http://www.computerhope.com/issues/ch000549.htm.

Daniel Haley
  • 51,389
  • 6
  • 69
  • 95
Blane
  • 643
  • 8
  • 13
1

at least on centOS:

[nsaunders@rolly ~]$ 
[nsaunders@rolly ~]$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 8.2.2004 (Core) 
Release:    8.2.2004
Codename:   Core
[nsaunders@rolly ~]$ 

it's as easy as:

sudo yum install xmlstarlet so that now xmllint is installed as:

[nsaunders@rolly ~]$ 
[nsaunders@rolly ~]$ xmllint --version
xmllint: using libxml version 20907
   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 FTP HTTP DTDValid HTML Legacy C14N Catalog XPath XPointer XInclude Iconv ISO8859X Unicode Regexps Automata Expr Schemas Schematron Modules Debug Zlib Lzma 
[nsaunders@rolly ~]$ 
  • Those are two different packages. The `xmllint` binary comes from the libxml2 package on CentOS, not [xmlstarlet](https://xmlstar.sourceforge.net/). Try `rpm -ql xmlstarlet | grep xmllint` then `rpm -ql libxml2 | grep xmllint` (assuming both packages are installed). – TheDudeAbides Apr 09 '23 at 14:10
1

On Windows (I'm using 10 Pro, but this could work on most versions I suppose) I work with MobaXTerm which provides an ubuntu terminal emulation, and installing xmllint is a one liner:

apt install libxml2
user1427673
  • 119
  • 1
  • 6