Open valinaga opened 7 years ago
I encountered the [xmldom error] entity not found:—
error. I've switched to @valinaga's fork and my tests now pass. Thanks @valinaga.
They don't belong there. You need to include them.
https://stackoverflow.com/questions/13707500/how-to-include-html-entities-into-an-xml-file
@bigeasy can you elaborate how one "includes them"? I've tried to implement the SO answers but have not gotten it past the mdash.
What I'd like to work is something like this:
const o = {locator: {},errorHandler: (lvl, msg) => {throw new Error(msg)}}
new xmldom.DOMParser(o).parseFromString('<p>—</p>', 'text/xml')
That fails with:
Error: [xmldom error] element parse error: Error: [xmldom error] entity not found:—
!ENTITY blocks have not helped, e.g.
new xmldom.DOMParser(o).parseFromString('<?xml version="1.0" encoding="utf-8"?> <!ENTITY mdash "—"> <p>—</p>', 'text/xml')
Is this the direction you're suggesting as an alternative to this pull request?
(and I didn't mean to steal your thread @valinaga, if this is noise for your problem I can make a new thread)
Looking at the code quickly, I don't see that the parser parses ENTITY processing instructions. Will look harder tonight.
@bigeasy did you get a chance to look further into this? I don't mean to imply impatience on my part, I'm happy this project exists at all and that you chose to contribute :), but in the event that you have had time to look into this matter I will happily listen for hints and help on a schedule that suits you, as I have been unable to progress on my own.
For epub documents which includes these special symbols, exception was raised if not found. Adding them to entityMap fixed the problem.