jindw / xmldom

A PURE JS W3C Standard based(XML DOM Level2 CORE) DOMParser and XMLSerializer.
Other
819 stars 265 forks source link

Markup in Entities breaks parsing #210

Open Holzhaus opened 7 years ago

Holzhaus commented 7 years ago

The parser fails when an Entity Declaration contains Markup.

Consider this XML document:

<!DOCTYPE root [
  <!ENTITY foo "<a b='c'>bar</a>">
]>
<root/>

The xmldom output makes no sense at all:

var doc = (new DOMParser()).parseFromString('<!DOCTYPE root [ <!ENTITY foo "<a b=\'c\'>bar</a>"> ]><root/>', 'text/xml');
console.log(doc+'')
// Output: <!DOCTYPE root><a b="c">bar</a>"> ]><root/>