File: cleanSchema

package info (click to toggle)
collada-dom 2.4.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 17,096 kB
  • sloc: cpp: 156,849; php: 4,567; makefile: 38; sh: 32; python: 14
file content (27 lines) | stat: -rwxr-xr-x 978 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash

if [ ! -f "$1" ]; then
    echo "Error: invalid schema"
    echo "Usage: cleanSchema colladaSchema.xsd"
    exit
fi

newFile=`dirname "$1"`/`basename "$1" .xsd`_cleaned.xsd
cp "$1" "$newFile"

# Remove type name annotations
perl -piU -e 's/_type"/"/g' "$newFile"
perl -piU -e 's/_group"/"/g' "$newFile"
perl -piU -e 's/_enum"/"/g' "$newFile"
perl -piU -e 's/_enum / /g' "$newFile"
        
# node_type and node_enum both map down to node, which causes a
# conflict. Put back the _enum annotation on node_enum.
perl -piU -e 's/xs:simpleType name="node">/xs:simpleType name="node_enum">/g' "$newFile"
perl -piU -e 's/name="type" type="node"/name="type" type="node_enum"/g' "$newFile"
        
# The DOM doesn't handle the mathml spec. Replace it with an xs:any so people
# can do whatever they want instead.
perl -piU -e 's/<xs:element ref="math:math"/<xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded"/g' "$newFile"

rm "$newFile"U