Skip to content

Commit 9004a8e

Browse files
committed
Python: Fix characteristic predicate of XMLParent
Like in #2520
1 parent 5cea452 commit 9004a8e

File tree

1 file changed

+7
-0
lines changed
  • python/ql/src/semmle/python/xml

1 file changed

+7
-0
lines changed

python/ql/src/semmle/python/xml/XML.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ abstract class XMLLocatable extends @xmllocatable {
2929
* both of which can contain other elements.
3030
*/
3131
class XMLParent extends @xmlparent {
32+
33+
XMLParent() {
34+
// explicitly restrict `this` to be either an `XMLElement` or an `XMLFile`;
35+
// the type `@xmlparent` currently also includes non-XML files
36+
this instanceof @xmlelement or xmlEncoding(this, _)
37+
}
38+
3239
/**
3340
* A printable representation of this XML parent.
3441
* (Intended to be overridden in subclasses.)

0 commit comments

Comments
 (0)