0031662: Modeling Algorithms - Incomplete result of section operation
[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
863f782a 25if { [checkplatform -windows] } {
607a96d4 26 if {[regexp -nocase {jdk} $env(PATH)] || [regexp -nocase {java} $env(PATH)]} {
863f782a 27 set Java "java"
607a96d4 28 } else {
863f782a 29 puts "Warning: environment variable PATH doesn't contain path to Java"
607a96d4 30 }
31} else {
32 catch {set Java $env(JAVAHOME)/bin/java}
607a96d4 33}
34
35set SchemaFile ""
36
37proc SaveToFile { aD aFile } {
38 upvar $aD D
39 global FileSuffix ValidatorCheck
40 catch {[file delete ${aFile}]}
191082ac 41 SaveAs D $aFile
607a96d4 42 if { [file exists $aFile] } {
43 if { $FileSuffix == "xml" && $ValidatorCheck} {
44 ValidateXml $aFile
45 } else {
46 puts "Validation of XML file by XSD schema is not provided."
47 }
48 } else {
49 puts "Error : There is no ${aFile} file"
50 }
51 catch {[file attributes ${aFile} -permissions 0777]}
52}
53
54proc ValidateXml { aFile } {
55 global Validator Java SchemaFile
56 if { ![info exists Java] } {
57 puts "Error : Java is not exists"
58 return
59 }
60 set isValidInfo ""
61 set ValCommand "exec $Java -jar $Validator $SchemaFile ${aFile}"
62 set isValid [catch {set isValidInfo [eval $ValCommand]}]
63 puts $isValidInfo
64 if { ![regexp "the document is valid" ${isValidInfo}] } {
65 puts "Error : File is not valid"
66 }
67}