Open DanielZambranoC opened 3 years ago
@DanielZambranoC
type Obs struct {
XMLName xml.Name `xml:"obs"`
IndexDateString string `xml:"indexDateString"`
StatusCode string `xml:"statusCode"`
Value string `xml:"value"`
}
type Response struct {
XMLName xml.Name `xml:"GetSeriesResponse"`
GetSeriesResult struct {
XMLName xml.Name `xml:"GetSeriesResult"`
Series struct {
XMLName xml.Name `xml:"Series"`
FameSeries struct {
XMLName xml.Name `xml:"fameSeries"`
Obs []Obs
}
}
}
}
of course you must set correct data types for Obs
fields )
and yes, you can shortcut XMLName
tags like this:
type Response struct {
XMLName xml.Name `xml:"GetSeriesResponse"`
GetSeriesResult struct {
Series struct {
FameSeries struct {
Obs []Obs `xml:"obs"`
} `xml:"fameSeries"`
} `xml:"Series"`
} `xml:"GetSeriesResult"`
}
@tiaguinho this issue is stale and resolved. You can close it, I think...
Hi, I've been trying to parse an answer and I still can't get it right.
I have tried in different ways, which I believe closer has been the structure provided by this tool (https://www.onlinetool.io/xmltogo/)
I need to be able to extract indexDateString and value
Can you advise me on where I am failing?
Error obtained:
xml.Unmarshal error: EOF
Try 1
Try 2
Response