XML is a very common format for data exchange. The Go library contains support for parsing XML files the same way as the JSON. Usually, the struct which corresponds to the XML scheme is used and with this help, the XML content is parsed at once. The problem is when the XML file is too large to fit into memory and so you need to parse the file in chunks. This recipe will reveal how to handle a large XML file and parse the required information.
Parsing a large XML file effectively
How to do it...
- Open the console and create the folder chapter05/recipe11.
- Navigate to the directory.
- Create the data.xml file with the following XML content:
<?xml version="1.0"?>
<catalog>
<book...