xmllint: add --nonet in more places.
[gnumeric.git] / tools / xmlunzip
blob2b8bc8854491c1457123d9df4feb6e8f77324507
1 #!/bin/sh
3 # quick and simple
4 case "$1" in
5 # OpenOffice 2.x
6 *.ods) suffix=.ods ;;
7 *.odt) suffix=.odt ;;
8 *.odp) suffix=.odp ;;
9 *.odg) suffix=.odg ;;
10 *.odf) suffix=.odf ;;
12 # OpenOffice 1.x
13 *.sxc) suffix=.sxc ;;
14 *.stc) suffix=.stc ;;
15 *.sxt) suffix=.sxt ;;
16 *.sxp) suffix=.sxp ;;
18 # Office12
19 *.xlsx) suffix=.xlsx ;;
20 *.xlsm) suffix=.xlsm ;;
21 *.docx) suffix=.docx ;;
22 *.docm) suffix=.docm ;;
23 *.pptx) suffix=.pptx ;;
24 *.pptm) suffix=.pptm ;;
25 esac
27 dir=`basename "$1" $suffix`
28 rm -rf "$dir"
29 unzip -q -d "$dir" "$1"
30 cd "$dir"
31 IFS='
33 files=`find . -name \*.xml -o -name \*.rels`
35 tmpfile=".dumper-$$.xml"
36 for f in $files ; do
37 if [ -s "$f" ] ; then
38 xmllint --nonet --format "$f" > "$tmpfile"
39 mv "$tmpfile" "$f"
40 elif [ ! -f "$f" ] ; then
41 echo "MISSING '$f'"
43 done