Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Подключить валидацию XML #4

Open
qertis opened this issue Jan 6, 2023 · 0 comments
Open

Подключить валидацию XML #4

qertis opened this issue Jan 6, 2023 · 0 comments
Assignees

Comments

@qertis
Copy link
Owner

qertis commented Jan 6, 2023

package.json

"validate-with-xmllint": "1.2.1"

xml-validator.js

const fs = require('fs');
const { validateXML } = require('validate-with-xmllint');

const [nodePath, executorPath, filename] = process.argv;

const file = fs.readFileSync(filename);
const xml = file.toString();

validateXML(xml).then(response => {
  console.log(filename, 'PASS');
}).catch(error => {
  console.error(error.message);
  process.exit(1);
});

test.sh

#!/bin/sh

echo 'XML validate'
XMLs=(sitemap.xml opensearch.xml)
for item in ${XMLs[*]}
do
  node ./xml-validator.js ./www/"$item"
done
@qertis qertis self-assigned this Jan 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant