Validating Crossref XML Locally Using xmllint

🧪 Crossref XML Validator Setup (Local Machine - Linux/Ubuntu on Windows)
This guide walks you through the steps to set up a Crossref XML validator locally using xmllint and Crossref XSD schemas.

✅ Prerequisites
Windows system with support for Linux distributions (via WSL - Windows Subsystem for Linux or a VM).

Internet access.

🖥️ Step 1: Install Ubuntu (or Any Linux Distro) on Windows
You can install Ubuntu via WSL:

Launch Ubuntu and complete the initial setup (username/password).

🔧 Step 2: Install xmllint
Once inside the Ubuntu shell:

sudo apt update
sudo apt install libxml2-utils

This installs xmllint, a command-line XML tool that can validate XML files against XSDs.

📦 Step 3: Clone Crossref Schema Repository
Download all available versions of Crossref XSD files:


git clone https://gitlab.com/crossref/schema.git
Navigate to the cloned folder:
cd schema/schemas

You will see directories for multiple schema versions (e.g., crossref5.3.1.xsd, etc.).

📁 Step 4: Prepare Your XML File
Place your Crossref-generated XML file (gen.xml) either:

Inside the schema/schemas folder, or

Anywhere on your local filesystem (just provide the correct path during validation).

✅ Step 5: Validate XML Using xmllint
Run the following command:


xmllint --noout --schema [path-to-xsd-file] [path-to-xml-file]
Example:
xmllint --noout --schema crossref5.3.1.xsd gen.xml


--noout: Prevents printing of the parsed XML.

--schema: Specifies the XSD file to validate against.

gen.xml: Your Crossref XML file.
0
Subscribe to my newsletter

Read articles from Amith Thillenkery directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Amith Thillenkery
Amith Thillenkery

Senior Software engineer at PIT Solution