type VastHtml struct {
VAST struct {
Version string `xml:"version,attr"`
Ad struct {
Id string `xml:"id,attr"`
InLine struct {
AdSystem string `xml:"AdSystem"`
AdTitle string `xml:"AdTitle"`
Description string `xml:"Description"`
Error string `xml:"Error"`
Impression []string `xml:"Impression"`
Creatives struct {
Creative []struct {
Sequence string `xml:"sequence,attr"`
Id string `xml:"id,attr"`
Linear struct {
Duration string `xml:"Duration"`
TrackingEvents struct {
Tracking []string `xml:"Tracking"`
} `xml:"TrackingEvents"`
VideoClicks struct {
ClickThrough string `xml:"ClickThrough"`
CustomClick []string `xml:"CustomClick"`
} `xml:"VideoClicks"`
MediaFiles struct {
MediaFile []struct {
Delivery string `xml:"delivery,attr"`
Bitrate string `xml:"bitrate,attr"`
Width string `xml:"width,attr"`
Height string `xml:"height,attr"`
Type string `xml:"type,attr"`
} `xml:"MediaFile"`
} `xml:"MediaFiles"`
} `xml:"Linear"`
CompanionAds struct {
Companion []struct {
Width string `xml:"width,attr"`
Height string `xml:"height,attr"`
StaticResource string `xml:"StaticResource"`
TrackingEvents string `xml:"TrackingEvents"`
CompanionClickThrough string `xml:"CompanionClickThrough"`
} `xml:"Companion"`
} `xml:"CompanionAds"`
} `xml:"Creative"`
} `xml:"Creatives"`
Extensions string `xml:"Extensions"`
} `xml:"InLine"`
} `xml:"Ad"`
} `xml:"VAST"`
}
func main()
{
resp, err := http.Get("http://ad3.liverail.com/?LR_PUBLISHER_ID=1331&LR_CAMPAIGN_ID=229&LR_SCHEMA=vast2")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
defer resp.Body.Close()
xmlDataFromHttp, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(os.Stdout, string(xmlDataFromHttp))
// read xml http response
var xmlData VastHtml
err = xml.Unmarshal(xmlDataFromHttp, &xmlData)
if err != nil {
panic(err)
}
fmt.Printf("XML===>: ", xmlData.VAST)
}
Hello everone, after Unmarshaling the XmlVast that I get from an URL that's give just the struct but without any value. even when i copy the content of the XmlVast in a file and I try to Unmarshal it it give me the same responce the struct without any value.
Thank you in advance.