mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
535e427272
commit
f2539b1417
2 changed files with 24 additions and 2 deletions
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue