Search⌘ K

The XML Data Format

This lesson discusses specifically the XML type of data, and how Go reads and writes data in the XML format efficiently.

What is XML? #

XML is a markup language that sets some rules to encode data in both human and machine-readable format. It stands for eXtensible Markup Language. The XML equivalent for the JSON example used in the last lesson is:

<Person>
<FirstName>Laura</FirstName>
<LastName>Lynn</LastName>
</Person>
svg viewer

Marshalling and unmarshaling

Like the json package xml contains a Marshal() and an UnMarshal() function to encode and decode data to and from XML. In the same way as with JSON, XML-data can be marshaled or un-marshaled to/from structs.

Here is an example where we see this in ...