-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Description
by jimteeuwen:
What steps will reproduce the problem? Build and run the following code: package main import "xml" import "strings" import "fmt" import "os" func main() { fragment := `<test><![CDATA[ &val=foo ]]></test>` parser := xml.NewParser(strings.NewReader(fragment)) var err os.Error for { if _, err = parser.Token(); err != nil { if err == os.EOF { return } fmt.Fprintf(os.Stderr, "Xml Error: %s\n", err) return } } } What is the expected output? Program should run without error. What do you see instead? Xml Error: XML syntax error on line 1: invalid character entity &val; Which compiler are you using (5g, 6g, 8g, gccgo)? 6g Which operating system are you using? 64-bit ArchLinux Which revision are you using? (hg identify) e1752be5d932 tip Please provide any additional information below. The XML parser in the Go xml package should ignore special tokens like & and < or > when they are inside a <![CDATA[ ... ]]> tag. The current implementation does not and consequently yields parse errors where it should not.