-
Notifications
You must be signed in to change notification settings - Fork 17
/
dtd2xml2json
executable file
·43 lines (36 loc) · 1.5 KB
/
dtd2xml2json
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true;
esac
# Figure out DTDANALYZER_HOME, which is the directory in which this script
# resides. Note that this resolves symlinks (HT Gerrit Imsieke). First check
# if greadlink exists (Mac OS X) and if so, use that.
if hash greadlink 2>/dev/null; then
READLINK=greadlink
else
READLINK=readlink
fi
DTDANALYZER_HOME="$( cd -P "$(dirname $( $READLINK -f "${BASH_SOURCE[0]}" ))" && pwd )"
# Add the build directory to the classpath. This script is used both by
# developers and users. For developers, the .class files in the build
# directory will be found first. Users don't have a build directory.
CP="$DTDANALYZER_HOME/build"
# Add all the .jar files in the lib subdirectory to the classpath
for jar in "$DTDANALYZER_HOME"/lib/*.jar "$DTDANALYZER_HOME"/lib/*/*.jar
do
CP="$CP:$jar"
done
# If we're on cygwin, convert the format of the classpath and home directory
if $cygwin; then
CP="$(cygpath -map "$CP")"
DTDANALYZER_HOME="$(cygpath -ma "$DTDANALYZER_HOME")"
fi
# We're not using log4j yet, but we might in the future. Until then, this
# shouldn't do any harm.
LOGCONFIG=${LOGCONFIG:-file:"$DTDANALYZER_HOME"/etc/log4j.properties}
# And, execute! Setting the DTDANALYZER_HOME system property so that
# the utility can find supplementary files like XSLT, CSS and JS.
exec java -cp "$CP" -Xmx256M "-Dlog4j.configuration=${LOGCONFIG}" \
"-DDTDANALYZER_HOME=$DTDANALYZER_HOME" \
gov.ncbi.pmc.dtdanalyzer.Dtd2Xml2Json "$@"