我的 XML 数据:
<dictionary version="0.8" revision="403605">
<grammemes>
<grammeme parent="">POST</grammeme>
<grammeme parent="POST">NOUN</grammeme>
</grammemes>
</dictionary>
我的代码:
type Dictionary struct {
XMLName xml.Name `xml:"dictionary"`
Grammemes *Grammemes `xml:"grammemes"`
}
type Grammemes struct {
Grammemes []*Grammeme `xml:"grammeme"`
}
type Grammeme struct {
Name string `xml:"grammeme"`
Parent string `xml:"parent,attr"`
}
我得到 Grammeme.Parent 属性,但我没有得到 Grammeme.Name。为什么?
相关分类