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 关注
- 81 浏览
添加回答
举报