Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- export enableDelayedExpansion
- xmlint="C:\lib\libxml2-2.9.3\bin\xmllint.exe"
- xml_file="${1}"
- schema_file="${2}"
- stderr_file="${3}"
- temp_file="${3}"
- xml_file_path="$(dirname ${xml_file})"
- xml_file_name="$(basename ${xml_file})"
- # :: XMLLINT_INDENT must be set to a tab character, make sure you use an editor that does not replace tab charcters with spaces
- export XMLLINT_INDENT=$'\t'
- cd "${xml_file_path}"
- # :: formating xml file with line breaks and indents
- "${xmlint}" "${xml_file_name}" --format --recover > "${temp_file}" && mv -f "${temp_file}" "${xml_file_name}"
- # :: validating against schema
- "${xmlint}" "${xml_file_name}" -schema "${schema_file}" -noout -stream 2> "${stderr_file}"
Advertisement
Add Comment
Please, Sign In to add comment