Closed
Description
What version of Go are you using (go version
)?
go version go1.8.3 darwin/amd64
What operating system and processor architecture are you using (go env
)?
darwin/amd64
What did you do?
StartElement and EndElement should not match if prefix does not match
go program used to test: (https://play.golang.org/p/3hUyUhbK5D)
package main
import (
"encoding/xml"
"fmt"
"io"
"strings"
)
func main() {
data := `<x:book xmlns:x="abcd" xmlns:y="abcd">one</y:book>`
decoder := xml.NewDecoder(strings.NewReader(data))
for {
_, err := decoder.Token()
if err != nil {
if err != io.EOF {
fmt.Println(err)
}
return
}
}
}
What did you expect to see?
XML syntax error on line 1: element <x:book> closed by </y:book>
What did you see instead?
``
Tested the same with xmllint program:
$ cat test.xml
<x:book xmlns:x="abcd" xmlns:y="abcd">one</y:book>
$ xmllint test.xml
test.xml:1: parser error : Opening and ending tag mismatch: book line 1 and book
<x:book xmlns:x="abcd" xmlns:y="abcd">one</y:book>
^