@@ -20,12 +20,12 @@ class OrderedObjParser{
2020 this . tagsNodeStack = [ ] ;
2121 this . docTypeEntities = { } ;
2222 this . lastEntities = {
23- "amp" : { regex : / & ( a m p | # 3 8 | # x 2 6 ) ; / g, val : "&" } ,
2423 "apos" : { regex : / & ( a p o s | # 3 9 | # x 2 7 ) ; / g, val : "'" } ,
2524 "gt" : { regex : / & ( g t | # 6 2 | # x 3 E ) ; / g, val : ">" } ,
2625 "lt" : { regex : / & ( l t | # 6 0 | # x 3 C ) ; / g, val : "<" } ,
2726 "quot" : { regex : / & ( q u o t | # 3 4 | # x 2 2 ) ; / g, val : "\"" } ,
2827 } ;
28+ this . ampEntity = { regex : / & ( a m p | # 3 8 | # x 2 6 ) ; / g, val : "&" } ;
2929 this . htmlEntities = {
3030 "space" : { regex : / & ( n b s p | # 1 6 0 ) ; / g, val : " " } ,
3131 // "lt" : { regex: /&(lt|#60);/g, val: "<" },
@@ -364,6 +364,7 @@ const parseXml = function(xmlData) {
364364}
365365
366366const replaceEntitiesValue = function ( val ) {
367+
367368 if ( this . options . processEntities ) {
368369 for ( let entityName in this . docTypeEntities ) {
369370 const entity = this . docTypeEntities [ entityName ] ;
@@ -379,6 +380,7 @@ const replaceEntitiesValue = function(val){
379380 val = val . replace ( entity . regex , entity . val ) ;
380381 }
381382 }
383+ val = val . replace ( this . ampEntity . regex , this . ampEntity . val ) ;
382384 }
383385 return val ;
384386}
0 commit comments