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] } {
31 if {[regexp -nocase {jdk} $env(PATH)] || [regexp -nocase {java} $env(PATH)]} {
34 puts "Warning: environment variable PATH doesn't contain path to Java"
37 catch {set Java $env(JAVAHOME)/bin/java}
42 proc SaveToFile { aD aFile } {
44 global FileSuffix ValidatorCheck
45 catch {[file delete ${aFile}]}
47 if { [file exists $aFile] } {
48 if { $FileSuffix == "xml" && $ValidatorCheck} {
51 puts "Validation of XML file by XSD schema is not provided."
54 puts "Error : There is no ${aFile} file"
56 catch {[file attributes ${aFile} -permissions 0777]}
59 proc ValidateXml { aFile } {
60 global Validator Java SchemaFile
61 if { ![info exists Java] } {
62 puts "Error : Java is not exists"
66 set ValCommand "exec $Java -jar $Validator $SchemaFile ${aFile}"
67 set isValid [catch {set isValidInfo [eval $ValCommand]}]
69 if { ![regexp "the document is valid" ${isValidInfo}] } {
70 puts "Error : File is not valid"