You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The same XML document behave differently in browser and with xmldom.
First, in browser (Firefox 75)
<script>
xml = '<?xml version="1.0" encoding="UTF-8"?>'
xml = xml + "\n<!DOCTYPE tag1 [\n"
xml = xml + "<!ENTITY hello \"hello1\">\n"
xml = xml + "<!ENTITY there \"there1\">\n"
xml = xml + "]>\n"
xml = xml + "<tag1>Stuff in &hello;</tag1>"
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(xml, "text/xml");
alert(xmlDoc.doctype);
</script>
Result: [object DocumentType]
Then, the same XML document with xmldom
xml = '<?xml version="1.0" encoding="UTF-8"?>'
xml = xml + "\n<!DOCTYPE tag1 [\n"
xml = xml + "<!ENTITY hello \"hello1\">\n"
xml = xml + "<!ENTITY there \"there1\">\n"
xml = xml + "]>\n"
xml = xml + "<tag1>Stuff in here</tag1>"
var DOMParser = require('xmldom').DOMParser;
var doc = new DOMParser().parseFromString(xml);
console.info(doc.doctype);
Result: null (the attribute doctype does exist, its value is null)
The document used in these examples:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tag1 [
<!ENTITY hello "hello1">
<!ENTITY there "there1">
]>
<tag1>Stuff in here</tag1>
The text was updated successfully, but these errors were encountered:
The same XML document behave differently in browser and with xmldom.
First, in browser (Firefox 75)
Result:
[object DocumentType]
Then, the same XML document with xmldom
Result:
null
(the attributedoctype
does exist, its value isnull
)The document used in these examples:
The text was updated successfully, but these errors were encountered: