Output as XML (with issues)

This code outputs the data as an XML file. The biggest issue is that it
only outputs one work from each page and I don’t know how to fix that.
Another thing is that it seems to have issues with accents and
outputting as a JSON file is even worse for that.