I have am xsd describing an XML schema and I am trying to write the representation of this xsd in go structures so I am able to marshal/unmarshal XML based on this schema.
Here is some go playground code I wrote to reproduce the problem I am having.
https://play.golang.org/p/ktJOsCDyLW
In the schema, the tags video
and web
are dynamic (as in they can both appear under media
more than once and have different content inside).
I attempted writing a dynamic struct along with the Unmarshaller/Marshaller interface as the example shows and I seem to be able to perform the parsing but it unmarshals/marshals the internal content incorrect ignoring the Name and URL lists, only taking one element of each.
I am uncertain what the issue is here.
Any help on the matter is appreciated
I have modified your sample here https://play.golang.org/p/rbcoL0ayeb. Change your definition to following:
Series:
type Series struct {
Name []Name `xml:"name"`
}
Website:
type Website struct {
Url []Url `xml:"url"`
}