I am trying to unmarshal XML from RRD format.
So I create my types etc, etc. which I am able to get the values from.
But there are comments in the XML in this format <!-- 2017/01/01 -->
and I need to extract this date. Is there any way of accessing this in GO ?
Thanks.
Updated question:
Okay I did it works, but I want to split the comments into array.
For example I have the following XML.
<database>
<!-- Random Info. -->
<row>10101</row>
<!-- Random Info2 . -->
<row>10102</row>
</database>
So I have the following.
type Database struct {
Comment string `xml:",comment"`
Row []string `xml:"row"`
}
Now when I print the row data I get it as an array whereas the comment is a string. I tried to make it an array but it throws an error cannot convert. panic: reflect.Set: value of type []uint8 is not assignable to type []string
Obviously, I can split the string and get what I want. But is there any quicker way of doing this when creating type?