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
25 if { [checkplatform -windows] } {
26 if {[regexp -nocase {jdk} $env(PATH)] || [regexp -nocase {java} $env(PATH)]} {
29 puts "Warning: environment variable PATH doesn't contain path to Java"
32 catch {set Java $env(JAVAHOME)/bin/java}
37 proc SaveToFile { aD aFile } {
39 global FileSuffix ValidatorCheck
40 catch {[file delete ${aFile}]}
42 if { [file exists $aFile] } {
43 if { $FileSuffix == "xml" && $ValidatorCheck} {
46 puts "Validation of XML file by XSD schema is not provided."
49 puts "Error : There is no ${aFile} file"
51 catch {[file attributes ${aFile} -permissions 0777]}
54 proc ValidateXml { aFile } {
55 global Validator Java SchemaFile
56 if { ![info exists Java] } {
57 puts "Error : Java is not exists"
61 set ValCommand "exec $Java -jar $Validator $SchemaFile ${aFile}"
62 set isValid [catch {set isValidInfo [eval $ValCommand]}]
64 if { ![regexp "the document is valid" ${isValidInfo}] } {
65 puts "Error : File is not valid"