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 set env(os_type) $tcl_platform(platform)
26 if { [regexp "indows" $env(os_type)] } {
27 if {[regexp -nocase {jdk} $env(PATH)] || [regexp -nocase {java} $env(PATH)]} {
30 puts "Warning: environment variable PATH doesn't contain path to Java"
33 catch {set Java $env(JAVAHOME)/bin/java}
38 proc SaveToFile { aD aFile } {
40 global FileSuffix ValidatorCheck
41 catch {[file delete ${aFile}]}
43 if { [file exists $aFile] } {
44 if { $FileSuffix == "xml" && $ValidatorCheck} {
47 puts "Validation of XML file by XSD schema is not provided."
50 puts "Error : There is no ${aFile} file"
52 catch {[file attributes ${aFile} -permissions 0777]}
55 proc ValidateXml { aFile } {
56 global Validator Java SchemaFile
57 if { ![info exists Java] } {
58 puts "Error : Java is not exists"
62 set ValCommand "exec $Java -jar $Validator $SchemaFile ${aFile}"
63 set isValid [catch {set isValidInfo [eval $ValCommand]}]
65 if { ![regexp "the document is valid" ${isValidInfo}] } {
66 puts "Error : File is not valid"