Borrowed pointer refactoring

- Due to problems with borrowed pointers, I've switched to managed
  boxes, so this XML parser requires GC. This might require a thourough
  redesign in future to get away from GC, but for now the sanity will be
  preserved by using managed boxes. Hurray!