Hi,
I have the following go code.
type Root struct {
Source Source
}
type Source struct {
Data string `xml:"encoding"`
}
func main() {
x := `<root><source:encoding><![CDATA[Hello]]></source:encoding></root>`
r := Root {}
_ = xml.Unmarshal([]byte(x), &r)
fmt.Println(r.Source)
}
I want to get the string "Hello" into the Source member (by changing it to string) or Data member. What should I do for this ? If the "<source" xml element does not have the ":encoding" part in it, I can successfully get the string "Hello" read. Can someone help me with this ?
Thanks a lot
Sankar