xmlv() { xmllint --noout --xinclude --schema "$1" "$2" 2>&1; } xmlv2() { xmlstarlet val --err -w --xsd "$1" "$2" 2>&1; } xmlvv() { #schema="$(xqilla -i "$1" /dev/stdin <<<"/*/namespace-uri()")" #schemaLocations="$(xqilla -i "$1" /dev/stdin <<<"/*/@xsi:schemaLocation/string()")" { read schema; read noNamespaceSchemaLocation; read schemaLocations; } < <(xqilla -i "$1" /dev/stdin <<<"(concat('',/*/namespace-uri()),concat('',/*/@xsi:no NamespaceSchemaLocation/string()),/*/@xsi:schemaLocation/string())";) # echo $schema; echo $noNameSpaceSchemaLocation; echo $schemaLocations; if [ -n "$noNamespaceSchemaLocation" ]; then schema="$noNamespaceSchemaLocation"; elif [ -n "$schemaLocations" ]; then schema2="$(sed 's#[^ ]* [^ ]* #&\n#g' <<<"$schemaLocations" | sed -n "s# *\$##;s#^$schema ##p";)" [ -n "$schema2" ] && schema="$schema2"; fi if [ -z "$schema" ]; then echo "adjusting xmlns:default -> xmlns"; schema="$(xqilla -i "$1" /dev/stdin <<<"namespace-uri-for-prefix('default',/*)")" xmllint --noout --xinclude --schema "$schema" <(sed '2,4s# xmlns:default=# xmlns=#' "$1";) 2>&1; else xmllint --noout --xinclude --schema "$schema" "$1" 2>&1; fi } xmlvs() { xmllint --noout --xinclude --schema "http://www.w3.org/2001/XMLSchema" "$1" 2>&1; } xmlfilter0() { sed '2s/ xmlns=/ hugo=/' <"$1"; } xmlfilter() { xqilla -i "$1" /dev/stdin </dev/null | od -An -txC | tr -d ' \n' | tr 'a-z' 'A-Z'; } urldecode() { echo -e "$(sed 's@+@ @g;s@%@\\x@g' <<<"$1")"; } linty() { if [[ "$1" = "-v" ]]; then lintian --tag-display-limit 0 "$2" | lintian-annotate-hints; else lintian --tag-display-limit 0 "$1"; fi }