File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -1211,17 +1211,18 @@ func (d *Decoder) nsname() (name Name, ok bool) {
1211
1211
if ! ok {
1212
1212
return
1213
1213
}
1214
- if strings .Count (s , ":" ) > 1 {
1214
+ n := strings .Count (s , ":" )
1215
+ if n == 0 { // No colons, no namespace. OK.
1215
1216
name .Local = s
1216
- } else if i := strings . Index ( s , ":" ); i < 1 || i > len ( s ) - 2 {
1217
+ } else if n > 1 { // More than one colon, not OK.
1217
1218
name .Local = s
1219
+ return name , false
1220
+ } else if i := strings .Index (s , ":" ); i < 1 || i > len (s )- 2 { // Leading or trailing colon, not OK.
1221
+ name .Local = s
1222
+ return name , false
1218
1223
} else {
1219
1224
name .Space = s [0 :i ]
1220
- if strings .Contains (s [i + 1 :], ":" ) {
1221
- return name , false
1222
- } else {
1223
- name .Local = s [i + 1 :]
1224
- }
1225
+ name .Local = s [i + 1 :]
1225
1226
}
1226
1227
return name , true
1227
1228
}
You can’t perform that action at this time.
0 commit comments