Open kevinprotoss opened 10 years ago
see: sax.parse(source,defaultNSMap,entityMap); specify your entityMap yourself
it's new feature for xmldom: specify the entityMap on DOMParser constructor
Feature request: DOMParser option parameter entityMap.
if you replace the var entityMap = {'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"} with var entityMap = options.entityMap ? options.entityMap : {'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"} in source file dom-parser.js at method: DOMParser.prototype.parseFromString = function(source,mimeType)
i think is a good solution.
A "options.entityMap" patch would be great! #131
you can try this:
const XMLReader = require('xmldome/sax').XMLReader
const oldParse = XMLReader.prototype.parse
const myEntityMap = {
'times': '*'
};
XMLReader.prototype.parse = function(source,defaultNSMap,entityMap){
return oldParse.call(this, source, defaultNSMap, Object.assign(entityMap, myEntityMap));
};
Hello,
I used this module for parsing xml file which has the following data.
However, all these
&xsd;
stuff can not be parsed by xmldom. I get this error from sax.js:I think the xml is correct according to xml specification.
Best regards, Kevin