diff --git a/javascript/ql/src/semmle/javascript/XML.qll b/javascript/ql/src/semmle/javascript/XML.qll index 1bc2778a9b83..af06cedcbcd8 100755 --- a/javascript/ql/src/semmle/javascript/XML.qll +++ b/javascript/ql/src/semmle/javascript/XML.qll @@ -34,6 +34,12 @@ abstract class XMLLocatable extends @xmllocatable { * both of which can contain other elements. */ class XMLParent extends @xmlparent { + XMLParent() { + // explicitly restrict `this` to be either an `XMLElement` or an `XMLFile`; + // the type `@xmlparent` currently also includes non-XML files + this instanceof @xmlelement or xmlEncoding(this, _) + } + /** * Gets a printable representation of this XML parent. * (Intended to be overridden in subclasses.)