Gulp plugin to validate XML.
$ npm install gulp-xml-validator --save-dev// Gulpfile.mjs
import gulp from 'gulp';
import { xmlValidator } from 'gulp-xml-validator';
gulp.task('lint', () =>
gulp.src('**/*.xml')
.pipe(xmlValidator())
);Note
This package encourages the use of ESM. Read how to migrate your Gulpfile.
Files are parsed with xmldom. Any message it reports fails the task, including warnings: xmldom raises warnings for malformed XML it can recover from, such as unquoted attribute values (<a b=c>) or attributes without a value (<a b>).
All files are checked before the task fails, and the error lists every problem found. Files that pass validation continue down the stream.
Type: string
Default: "text/xml"
Allows modifying the MIME type passed to DOMParser().parseFromString(). An unsupported MIME type fails the task.
This work is licensed under The MIT License.