-
Notifications
You must be signed in to change notification settings - Fork 22
Formatting of Code
To harmonize the XML, XSD and WSDL-files they should always be treated with xmllint before integrating them. The following code shows an excerpt from a shell script doing exactly that:
#!/bin/bash /usr/bin/find . -name "*.xsd" -type f | while read i; do XMLLINT_INDENT=" " xmllint --pretty 1 "$i" > "$i.pretty"; mv "$i.pretty" "$i"; done; /usr/bin/find . -name "*.xml" -type f | while read i; do XMLLINT_INDENT=" " xmllint --pretty 1 "$i" > "$i.pretty"; mv "$i.pretty" "$i"; done; /usr/bin/find . -name "*.wsdl" -type f | while read i; do XMLLINT_INDENT=" " xmllint --pretty 1 "$i" > "$i.pretty"; mv "$i.pretty" "$i"; done; echo "finished formatting"
The script is executed with
bash xmllint-check.sh
Bash can be used on a windows machine via Cygwin (see link below).
- Usage: http://xmlsoft.org/xmllint.html
- Download: http://xmlsoft.org/downloads.html
- Installation: https://stackoverflow.com/questions/19546854/installing-xmllint
- Installation of Cygwin to use bash on windows: https://cygwin.com/install.html
The formatting with xmllint as shown above doesn't need to be done by the contributors. Changes to the SIRI-CEN repo are automatically corrected (or reformatted respectively) by TravisCI. If contributors still want to utilize xmllint or want to check/validate the changes themselves, they can use the xmllint-check script provided in the subfolder /.travis.