0027176: Configuration, CMake - INSTALL_DIR is a common prefix for all other install...
[occt.git] / tests / xml / begin
CommitLineData
607a96d4 1pload TOPTEST
2pload DCAF
3
4cpulimit 300
5
6set ValidatorCheck 0
7
8if { [info exists env(CSF_ValidatorPath)] != 0 } {
9 if {[file exists $env(CSF_ValidatorPath)]} {
10 set ValidatorCheck 1
11 set Validator $env(CSF_ValidatorPath)
12 }
13}
14
15if { [info exists imagedir] == 0 } {
16 set imagedir .
17}
18
19if { [info exists test_image ] == 0 } {
20 set test_image photo
21}
22
23set WorkDirectory $imagedir
24
37d6975c 25set env(os_type) $tcl_platform(platform)
26if { [regexp "indows" $env(os_type)] } {
607a96d4 27 if {[regexp -nocase {jdk} $env(PATH)] || [regexp -nocase {java} $env(PATH)]} {
28 set Java "java"
29 } else {
30 puts "Warning: environment variable PATH doesn't contain path to Java"
31 }
32} else {
33 catch {set Java $env(JAVAHOME)/bin/java}
607a96d4 34}
35
36set SchemaFile ""
37
38proc SaveToFile { aD aFile } {
39 upvar $aD D
40 global FileSuffix ValidatorCheck
41 catch {[file delete ${aFile}]}
191082ac 42 SaveAs D $aFile
607a96d4 43 if { [file exists $aFile] } {
44 if { $FileSuffix == "xml" && $ValidatorCheck} {
45 ValidateXml $aFile
46 } else {
47 puts "Validation of XML file by XSD schema is not provided."
48 }
49 } else {
50 puts "Error : There is no ${aFile} file"
51 }
52 catch {[file attributes ${aFile} -permissions 0777]}
53}
54
55proc ValidateXml { aFile } {
56 global Validator Java SchemaFile
57 if { ![info exists Java] } {
58 puts "Error : Java is not exists"
59 return
60 }
61 set isValidInfo ""
62 set ValCommand "exec $Java -jar $Validator $SchemaFile ${aFile}"
63 set isValid [catch {set isValidInfo [eval $ValCommand]}]
64 puts $isValidInfo
65 if { ![regexp "the document is valid" ${isValidInfo}] } {
66 puts "Error : File is not valid"
67 }
68}