A Python-based validator for XLIFF 2.2 files using local OASIS schema files.
- ✅ Validates XLIFF 2.2 files against official OASIS schemas
- ✅ Uses local schema files (no internet connection required)
- ✅ Detailed error reporting with line numbers and descriptions
- ✅ Smart schema file detection (supports multiple schema filenames)
- ✅ Simple command-line interface
- ✅ Proper handling of schema includes and imports
- Python 3.6 or higher
- lxml library
- Clone this repository:
git clone https://github.com/piotr-bienkowski/Xliff22-validator.git
cd xliff-validator- Install dependencies:
pip install lxml- Ensure schema files are present in the
Core/directory (see Schema Files section below)
python validate22.py your_file.xlfValidate a single XLIFF file:
python validate22.py translation.xlfExpected output for valid file:
✓ translation.xlf is valid XLIFF 2.2
Expected output for invalid file:
✗ translation.xlf has validation errors:
Line 15: Element '{urn:oasis:names:tc:xliff:document:2.0}target': This element is not expected.
This validator requires XLIFF 2.2 schema files in the Core/ directory.
Download the official schemas from: https://docs.oasis-open.org/xliff/xliff-core/v2.2/os/schemas/
Required files:
xliff_core_2.2.xsd(andxliff_core_2.0.xsd)- Supporting schema files (imports and includes)
Place all files in the Core/ directory.
If schema files are already included in this repository, no additional setup is needed.
Schema Copyright Notice: The XLIFF 2.2 schema files are copyright © OASIS Open. All Rights Reserved. These schemas are used under the terms specified by OASIS. Source: https://www.oasis-open.org/committees/xliff/
- The validator reads your XLIFF file
- Loads the XLIFF 2.2 schema from the
Core/directory - Temporarily changes working directory to resolve schema includes/imports
- Validates the XLIFF structure against the schema
- Reports any validation errors with line numbers
xliff-validator/
├── README.md # This file
├── validate22.py # Main validator script
├── Core/ # XLIFF 2.2 schema files
│ ├── xliff_core_2.2.xsd
│ └── (other schema files)
└── .gitignore # Git ignore patterns
If you've converted SDLXLIFF files to XLIFF 2.2, use this validator to ensure the output is schema-compliant:
python validate22.py converted_output.xlfValidate multiple files using a shell loop:
for file in *.xlf; do
python validate22.py "$file"
doneUse this validator in your translation workflow to ensure files are valid before processing:
# Convert file
python sdlxliff_to_xliff22.py input.sdlxliff -o output.xlf
# Validate output
python validate22.py output.xlf- Ensure the
Core/directory exists - Check that schema files are present
- Verify the schema filename matches supported names
- Check that all imported schema files are present
- Ensure proper file permissions
- Verify schema files are not corrupted
- Your XLIFF file may not be valid XLIFF 2.2
- Check the XLIFF version in the root element
- Ensure proper namespace usage
The validator automatically detects these schema filenames:
xliff_core_2.2.xsdxliff_core_2.0.xsd(XLIFF 2.2 uses 2.0 namespace)xliff-core-2.2.xsd
XLIFF 2.2 uses the namespace:
urn:oasis:names:tc:xliff:document:2.0
Note: XLIFF 2.2 uses the 2.0 namespace for backward compatibility.
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/improvement) - Make your changes
- Test your changes
- Commit (
git commit -am 'Add new feature') - Push to branch (
git push origin feature/improvement) - Open a Pull Request
- SDLXLIFF to XLIFF 2.2 Converter - Convert SDL Trados SDLXLIFF files to XLIFF 2.2
- Converter mentioned above will be coming soon
This utility is made available under the MIT license.
piotr-bienkowski
- OASIS XLIFF Technical Committee for the XLIFF standard
- lxml library developers
- Initial release
- Support for XLIFF 2.2 validation
- Local schema file support
- Detailed error reporting