1 回答

TA貢獻1865條經驗 獲得超7個贊
使用切片可以輕松解決我的問題。下面的代碼就是對應的結構體。
type Level struct {
Name string `xml:"name,attr"`
}
type Handler struct {
Name string `xml:"name,attr"`
}
type Handlers struct {
Handler []Handler `xml:"handler"`
}
type RootLogger struct {
Level Level `xml:"level"`
Handler Handlers `xml:"handlers"`
}
type DeploymentScanner struct {
Path string `xml:"path,attr"`
RelativeTo string `xml:"relative-to,attr"`
ScanInterval string `xml:"scan-interval,attr"`
}
type Subsystem struct {
XMLName xml.Name
RootLogger []RootLogger `xml:"root-logger"`
DeploymentScanner []DeploymentScanner `xml:"deployment-scanner"`
}
type Profile struct {
Subsystem []Subsystem `xml:"subsystem"`
}
- 1 回答
- 0 關注
- 99 瀏覽
添加回答
舉報