8 if { [info exists env(CSF_ValidatorPath)] != 0 } {
9 if {[file exists $env(CSF_ValidatorPath)]} {
11 set Validator $env(CSF_ValidatorPath)
15 if { [info exists imagedir] == 0 } {
19 if { [info exists test_image ] == 0 } {
23 set WorkDirectory $imagedir
26 if {[array get env os_type] != ""} {
30 if { [regexp "indows" $os ] == 1 } {
31 set env(CSF_TestDataPath) "$env(CSF_TestDataPath);$env(CASROOT)"
32 if {[regexp -nocase {jdk} $env(PATH)] || [regexp -nocase {java} $env(PATH)]} {
35 puts "Warning: environment variable PATH doesn't contain path to Java"
38 catch {set Java $env(JAVAHOME)/bin/java}
39 set env(CSF_TestDataPath) "$env(CSF_TestDataPath):$env(CASROOT)"
44 proc SaveToFile { aD aFile } {
46 global FileSuffix ValidatorCheck
47 catch {[file delete ${aFile}]}
49 if { [file exists $aFile] } {
50 if { $FileSuffix == "xml" && $ValidatorCheck} {
53 puts "Validation of XML file by XSD schema is not provided."
56 puts "Error : There is no ${aFile} file"
58 catch {[file attributes ${aFile} -permissions 0777]}
61 proc ValidateXml { aFile } {
62 global Validator Java SchemaFile
63 if { ![info exists Java] } {
64 puts "Error : Java is not exists"
68 set ValCommand "exec $Java -jar $Validator $SchemaFile ${aFile}"
69 set isValid [catch {set isValidInfo [eval $ValCommand]}]
71 if { ![regexp "the document is valid" ${isValidInfo}] } {
72 puts "Error : File is not valid"