Update: I came up with a different solution, so this is no longer a priority for me.
I want to write a routine that emojifies an OPML file.
https://gist.github.com/scripting/bcd76324a27b5567874b
It takes OPML text as input, parses it, walks the whole structure, and emojifies the text, and then replaces the original text with the new text.
At the end of the traversal, it re-serializes the XML text, and returns it.
However, I get an error at the crucial point, the call to serializeToString.
Uncaught TypeError: Failed to execute 'serializeToString' on 'XMLSerializer': Invalid node value.