Files
x/xhtml/xhtml_test.go

25 lines
398 B
Go

package xhtml_test
import (
"encoding/xml"
"log"
"testing"
)
func TestMain(t *testing.T) {
type Bold struct {
XMLName xml.Name `xml:"b"`
Content string `xml:",chardata"`
}
type test struct {
XMLName xml.Name `xml:"p"`
Content string `xml:",chardata"`
Bold []Bold `xml:"b"`
}
var v test
xml.Unmarshal([]byte(`<p>Hello, <b>world</b></p>`), &v)
log.Printf("%#v", v)
}