Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch win-uri-fix Excluding Merge-Ins
This is equivalent to a diff from 96b8d81fe9 to fadeed7802
2018-07-23
| ||
10:28 | Merged the fixes for the scripted helper procs baseURL and extRefHandler for Windows paths containing drive letters provided by Ashok P. Nadkarni. check-in: 905eec2720 user: rolf tags: trunk | |
2018-07-22
| ||
08:50 |
Fix baseURL and extRefHandler for Windows paths containing drive letters.
Note that the tcllib uri package used by extRefHandler was broken until
V1.2.7. This version only tested with that version.
There is still an unrelated bug pending in that URI's are supposed to be url-encoded but the code does not currently handle that and will fail for special characters in the path. Closed-Leaf check-in: fadeed7802 user: apnadkarni tags: win-uri-fix | |
2018-07-20
| ||
09:58 | Merged from trunk. check-in: 401652dca9 user: rolf tags: nearerTEAtoThee | |
2018-07-19
| ||
12:53 | Create new branch named "win-uri-fix" check-in: 7e818a10f8 user: apnadkarni tags: win-uri-fix | |
00:42 | Fixed the test suite so that it should run without failure even if the build dir is outside the source tree. check-in: 96b8d81fe9 user: rolf tags: trunk | |
2018-07-18
| ||
14:41 | Attempt to make tdom::baseURI return "the right thing" for absolute paths on windows. check-in: b4d45b8409 user: rolf tags: trunk | |
Changes to lib/tdom.tcl.
︙ | ︙ | |||
944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | not point to the foreign DTD" } } set absolutURI [uri::resolve $base $systemId] array set uriData [uri::split $absolutURI] switch $uriData(scheme) { file { return [list string $absolutURI [xmlReadFile $uriData(path)]] } default { error "can only handle file URI's" } } } } #---------------------------------------------------------------------------- # baseURL # # A simple convenience proc which returns an absolute URL for a given # filename. # #---------------------------------------------------------------------------- | > > > > > > > < > | > > > > | > | | < | > | | > | < | 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | not point to the foreign DTD" } } set absolutURI [uri::resolve $base $systemId] array set uriData [uri::split $absolutURI] switch $uriData(scheme) { file { if {$::tcl_platform(platform) eq "windows"} { # Strip leading / for drive based paths if {[string match /?:* $uriData(path)]} { set uriData(path) [string range $uriData(path) 1 end] } } # FIXME - path should be URL-decoded return [list string $absolutURI [xmlReadFile $uriData(path)]] } default { error "can only handle file URI's" } } } } #---------------------------------------------------------------------------- # baseURL # # A simple convenience proc which returns an absolute URL for a given # filename. # #---------------------------------------------------------------------------- proc tdom::baseURL {path} { # FIXME - path components need to be URL-encoded # Note [file join] will return path as is if it is already absolute. # Also on Windows, it will change \ -> /. This is necessary because # file URIs must always use /, never \. set path [file join [pwd] $path] if {$::tcl_platform(platform) ne "windows"} { return "file://$path" } else { if {[string match //* $path]} { # UNC path return "file:$path" } else { # Drive based path return "file:///$path" } } } namespace eval ::tDOM { variable extRefHandlerDebug 0 variable useForeignDTD "" |
︙ | ︙ |
Changes to tests/dom.test.
︙ | ︙ | |||
1050 1051 1052 1053 1054 1055 1056 | test dom-4.1 {-useForeignDTD 0} { set doc [dom parse -useForeignDTD 0 {<root/>}] $doc delete } {} test dom-4.2 {-useForeignDTD 1 with document with internal subset} {need_uri} { | | | | | | | 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | test dom-4.1 {-useForeignDTD 0} { set doc [dom parse -useForeignDTD 0 {<root/>}] $doc delete } {} test dom-4.2 {-useForeignDTD 1 with document with internal subset} {need_uri} { set baseURI [tdom::baseURL [file join [pwd] [file dir [info script]] dom.test]] set ::tdom::useForeignDTD "data/domCmd1.dtd" set doc [dom parse \ -useForeignDTD 1 \ -baseurl $baseURI \ -externalentitycommand ::tdom::extRefHandler { <!DOCTYPE root [ <!ATTLIST root fixed CDATA #FIXED "toThat"> ]> <root/>}] set root [$doc documentElement] set result [$root @fixed] $doc delete set result } {toThat} test dom-4.3 {-useForeignDTD 1 with document with internal subset} {need_uri} { set baseURI [tdom::baseURL [file join [pwd] [file dir [info script]] dom.test]] set ::tdom::useForeignDTD "data/domCmd1.dtd" set doc [dom parse \ -useForeignDTD 1 \ -baseurl $baseURI \ -externalentitycommand ::tdom::extRefHandler { <!DOCTYPE root [ <!ATTLIST root fixed2 CDATA #FIXED "toThat"> ]> <root/>}] set root [$doc documentElement] set result [$root @fixed] lappend result [$root @fixed2] $doc delete set result } {toThis toThat} test dom-4.4 {-useForeignDTD 1 with document without document declaration} {need_uri} { set baseURI [tdom::baseURL [file join [pwd] [file dir [info script]] dom.test]] set ::tdom::useForeignDTD "data/domCmd1.dtd" set doc [dom parse \ -useForeignDTD 1 \ -baseurl $baseURI \ -externalentitycommand ::tdom::extRefHandler <root/>] set root [$doc documentElement] set result [$root @fixed] $doc delete set result } {toThis} test dom-4.5 {-useForeignDTD 1 does not overwrite a given external subset} {need_uri} { set baseURI [tdom::baseURL [file join [pwd] [file dir [info script]] dom.test]] set ::tdom::useForeignDTD "data/domCmd1.dtd" set doc [dom parse \ -useForeignDTD 1 \ -baseurl $baseURI \ -externalentitycommand ::tdom::extRefHandler { <!DOCTYPE root SYSTEM "data/domCmd2.dtd"> <root/>}] set root [$doc documentElement] set result [$root @fixed] $doc delete set result } {toThat} test dom-4.6 {-useForeignDTD with nonboolean arg} {need_uri} { set result [catch {set doc [dom parse -useForeignDTD foo <root/>]} errMsg] lappend result $errMsg } {1 {expected boolean value but got "foo"}} test dom-5.1 {document with external subset} {need_uri} { set baseURI [tdom::baseURL [file join [pwd] [file dir [info script]] dom.test]] set doc [dom parse \ -baseurl $baseURI \ -externalentitycommand ::tdom::extRefHandler { <!DOCTYPE root SYSTEM "data/domCmd2.dtd"> <root/>}] set root [$doc documentElement] set result [$root @fixed] |
︙ | ︙ |
Changes to tests/domNode.test.
︙ | ︙ | |||
3020 3021 3022 3023 3024 3025 3026 | set result } {1 NOT_FOUND_ERR} test domNode-34.1 {getBaseURI} {need_uri} { makeFile <y/> domNode-34.1-e1.xml [file join [file dir [info script]] data] makeFile <y/> domNode-34.1-e2.xml [file join [file dir [info script]] data] | | | 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 | set result } {1 NOT_FOUND_ERR} test domNode-34.1 {getBaseURI} {need_uri} { makeFile <y/> domNode-34.1-e1.xml [file join [file dir [info script]] data] makeFile <y/> domNode-34.1-e2.xml [file join [file dir [info script]] data] set baseURI [tdom::baseURL [file join [pwd] [file dir [info script]] dom.test]] set doc [dom parse \ -baseurl $baseURI \ -externalentitycommand ::tdom::extRefHandler { <!DOCTYPE x [ <!ENTITY a SYSTEM "data/domNode-34.1-e1.xml"> <!ENTITY b SYSTEM "data/domNode-34.1-e2.xml"> ]> |
︙ | ︙ | |||
3052 3053 3054 3055 3056 3057 3058 | set result } {1} test domNode-34.2 {getBaseURI} {need_uri} { makeFile <y/> domNode-34.1-e1.xml [file join [file dir [info script]] data] makeFile <y/> domNode-34.1-e2.xml [file join [file dir [info script]] data] | | | 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 | set result } {1} test domNode-34.2 {getBaseURI} {need_uri} { makeFile <y/> domNode-34.1-e1.xml [file join [file dir [info script]] data] makeFile <y/> domNode-34.1-e2.xml [file join [file dir [info script]] data] set baseURI [tdom::baseURL [file join [pwd] [file dir [info script]] dom.test]] set doc [dom parse \ -baseurl $baseURI \ -externalentitycommand ::tdom::extRefHandler { <!DOCTYPE x [ <!ENTITY a SYSTEM "data/domNode-34.1-e1.xml"> <!ENTITY b SYSTEM "data/domNode-34.1-e2.xml"> ]> |
︙ | ︙ |