#! /bin/bash
cyflexlogevent -t generic -m 1 -m "script" -m "$0" 

#
# Script name: xml_xsd_validate <XML_FILE> <XSD_FILE>
#
# Purpose: This script will validate an XML file against an XSD file.
#
# Invoking arguments:
#    1 - xml file to be validated.
#    2 - xsd file to validate the xml file.
#
# Return:
#    1 - File errors - wrong number of command line arguments,
#        File argument does not exist.
#    2 - Validation errors.  Error messages written to standard out.
#
# Notes:
#    No output indicates that the xml file validated against the xsd
#    file.  Any messages indicate a problem.
#
# History:
#    10/09/10 - Rob Janes - Initial release
#

# Check number of command line arguments
if [ $# == 0 ] ; then
   echo
   echo Validate XML files against an XSD file.
   echo
   echo xml_xsd_validate  \<XML_FILE\> \<XSD_FILE\>
   exit 1
fi
if [ $# != 2 ] ; then
   echo Two command line arguments required.
   echo xml_xsd_validate  \<XML_FILE\> \<XSD_FILE\>
   exit 1
fi

# Validate the command line arguments are existing files.
if [ ! -e $1 ] ; then
   echo The first command line argument, $1, must be an existing file.
   exit 1
fi
if [ ! -e $2 ] ; then
   echo The second command line argument, $2, must be an existing file.
   exit 1
fi

. configure_java

BASE=$GUI
export CLASSPATH=$BASE/applications.jar:$BASE/specfilegui.jar:$D3/protobuf.jar
PROPS=-DPropertiesFile=$CELL/cui_properties.txt
java $PROPS com.cybermetrix.cyflex.applications.xml_xsd_validate $*
