Add support for XML declarations

- Ignore XML declarations at the beginning of the document
- Fix Dart warnings, e.g. `fold`, `reduce`, `remove`
- Fix package reference in test

Tested in Dart M4.