Allow underscores in XML element names (except for leading characters)

Fixes #569

R=rsc, r
CC=golang-dev
https://golang.org/cl/194121
This commit is contained in:
Michael Hoisie 2010-01-27 21:13:22 -08:00 committed by Rob Pike
parent 535e427272
commit f2539b1417
2 changed files with 24 additions and 2 deletions

View file

@ -5,6 +5,7 @@
package xml
import (
"bytes"
"io"
"os"
"reflect"
@ -212,3 +213,18 @@ func TestSyntax(t *testing.T) {
}
}
}
type item struct {
Field_a string
}
func TestIssue569(t *testing.T) {
data := `<item><field_a>abcd</field_a></item>`
var i item
buf := bytes.NewBufferString(data)
err := Unmarshal(buf, &i)
if err != nil || i.Field_a != "abcd" {
t.Fatalf("Expecting abcd")
}
}