Update of /cvsroot/htmlparser/htmlparser/bin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9169/bin
Added Files:
translate translate.bat
Log Message:
Rework character entity translation.
See task 58599 enhance character reference translation.
Decode now handles missing semi colons, encoding is more efficient,
hexadecimal numeric character entity references are handled and
both encoding and decoding make minimal use of substring().
Augmented the tests in CharacterTranslationTest significantly, and
merged the Generate class into the tests.
Added translate command scripts in bin, which read from stdin and write to stdout.
--- NEW FILE: translate ---
#! /bin/sh
if [ -z "$HTMLPARSER_HOME" ] ; then
## resolve links - $0 may be a link to the home
PRG="$0"
progname=`basename "$0"`
saveddir=`pwd`
# need this for relative symlinks
dirname_prg=`dirname "$PRG"`
cd "$dirname_prg"
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
HTMLPARSER_HOME=`dirname "$PRG"`/..
cd "$saveddir"
# make it fully qualified
HTMLPARSER_HOME=`cd "$HTMLPARSER_HOME" && pwd`
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD=`which java 2> /dev/null `
if [ -z "$JAVACMD" ] ; then
JAVACMD=java
fi
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly."
echo " We cannot execute $JAVACMD"
exit 1
fi
if [ -n "$CLASSPATH" ] ; then
LOCALCLASSPATH="$CLASSPATH"
fi
HTMLPARSER_LIB="${HTMLPARSER_HOME}/lib"
# add in the parser .jar file
if [ -z "$LOCALCLASSPATH" ] ; then
LOCALCLASSPATH="${HTMLPARSER_LIB}/htmlparser.jar"
else
LOCALCLASSPATH="${HTMLPARSER_LIB}/htmlparser.jar":"$LOCALCLASSPATH"
fi
# handle 1.1x JDKs
if [ -n "$JAVA_HOME" ] ; then
if [ -f "$JAVA_HOME/lib/classes.zip" ] ; then
LOCALCLASSPATH="$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip"
fi
fi
"$JAVACMD" -classpath "$LOCALCLASSPATH" org.htmlparser.util.Translate "$@"
--- NEW FILE: translate.bat ---
java -classpath ..\lib\htmlparser.jar org.htmlparser.util.Translate %1 %2
|