Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


While many uses of the encoding/xml package include marshaling and unmarshaling to a Go struct, it's worth noting that this is not a direct mapping. The package documentation states:

Mapping between XML elements and data structures is inherently flawed: an XML element is an order-dependent collection of anonymous values, while a data structure is an order-independent collection of named values.

For simple, unordered, key-value pairs, using a different encoding such as Gob's or JSON may be a better fit. For ordered data or event / callback based streams of data, XML may be the best choice.

Got any Go Question?