On Monday, 12 February 2018 at 16:50:16 UTC, Jonathan M Davis
wrote:
The core problem is that entity references get replaced with
more XML that needs to be parsed. So, they can't simply be
passed on for post-processing. As I understand it, they have to
be replaced while the parsing is going on. And that means that
you can't do something like return slices of the original input
that don't bother with the entity references and then have a
separate parser take that and process it further to deal with
the entity references. The first parser has to deal with them,
and that means not returning slices of the original input
unless you're dealing purely with strings and are willing to
allocate new strings in the cases where the data needs to be
mutated because of an entity reference.
Standard entities like & have the same problem, so the same
solution should work too.