Skip to content
Permalink
Browse files

validate.sh avslutter med non-zero exitcode ved valideringsfeil, for …

…å kunne brukes til automatisk validering f.eks. på byggserver.
  • Loading branch information...
runeflobakk committed May 13, 2014
1 parent 67f9e63 commit b681c33c700bc7452a2a7f2f870d3dee36f9f912
Showing with 22 additions and 3 deletions.
  1. +1 −1 eksempler/sdpMelding-digital.xml
  2. +21 −2 eksempler/validate.sh
@@ -7,7 +7,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://begrep.difi.no/sdp/schema_v10 ../xsd/sdp-melding.xsd ">

<konversasjonsId>00c5ae20-da79-11e3-9c1a-0800200c9a66</konversasjonsId>
<!-- <konversasjonsId>00c5ae20-da79-11e3-9c1a-0800200c9a66</konversasjonsId> -->

<signatur>
<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
@@ -3,6 +3,25 @@
eksempler=$(dirname "$0")
xsds="${eksempler}/../xsd"

xmllint --noout --schema ${xsds}/sdp.xsd ${eksempler}/sdp*.xml
xmllint --noout --schema ${xsds}/SBDH20040506-02/StandardBusinessDocumentHeader.xsd ${eksempler}/sbdh.xml

function validate {
local xmlFile="$1"
local schema="$2"
xmllint --noout --schema ${schema} ${xmlFile}
}

errors=0
for eksempel in ${eksempler}/sdp*.xml; do
validate ${eksempel} ${xsds}/sdp.xsd || ((errors++))
done

for eksempel in ${eksempler}/sbdh.xml; do
validate ${eksempel} ${xsds}/SBDH20040506-02/StandardBusinessDocumentHeader.xsd || ((errors++))
done


if (( errors > 0 )); then
echo Fant ${errors} filer med valideringsfeil!
exit 1
fi

0 comments on commit b681c33

Please sign in to comment.
You can’t perform that action at this time.