Skip to content

Commit 1b6bd7a

Browse files
committed
C#: Update XML.qll for backwards compatibility
1 parent 82c368e commit 1b6bd7a

File tree

1 file changed

+11
-6
lines changed
  • csharp/ql/src/semmle/code/csharp

1 file changed

+11
-6
lines changed

csharp/ql/src/semmle/code/csharp/XML.qll

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ abstract class XMLLocatable extends @xmllocatable {
99
/** Gets the source location for this element. */
1010
Location getLocation() { xmllocations(this, result) }
1111

12+
/**
13+
* DEPRECATED: Use `getLocation()` instead.
14+
*
15+
* Gets the source location for this element.
16+
*/
17+
deprecated Location getALocation() { result = this.getLocation() }
18+
1219
/**
1320
* Holds if this element is at the specified location.
1421
* The location spans column `startcolumn` of line `startline` to
@@ -155,7 +162,7 @@ class XMLFile extends XMLParent, File {
155162
* <!ELEMENT lastName (#PCDATA)>
156163
* ```
157164
*/
158-
class XMLDTD extends @xmldtd {
165+
class XMLDTD extends XMLLocatable, @xmldtd {
159166
/** Gets the name of the root element of this DTD. */
160167
string getRoot() { xmlDTDs(this, result, _, _, _) }
161168

@@ -171,8 +178,7 @@ class XMLDTD extends @xmldtd {
171178
/** Gets the parent of this DTD. */
172179
XMLParent getParent() { xmlDTDs(this, _, _, _, result) }
173180

174-
/** Gets a printable representation of this DTD. */
175-
string toString() {
181+
override string toString() {
176182
this.isPublic() and
177183
result = this.getRoot() + " PUBLIC '" + this.getPublicId() + "' '" + this.getSystemId() + "'"
178184
or
@@ -275,7 +281,7 @@ class XMLAttribute extends @xmlattribute, XMLLocatable {
275281
* xmlns:android="http://schemas.android.com/apk/res/android"
276282
* ```
277283
*/
278-
class XMLNamespace extends @xmlnamespace {
284+
class XMLNamespace extends XMLLocatable, @xmlnamespace {
279285
/** Gets the prefix of this namespace. */
280286
string getPrefix() { xmlNs(this, result, _, _) }
281287

@@ -285,8 +291,7 @@ class XMLNamespace extends @xmlnamespace {
285291
/** Holds if this namespace has no prefix. */
286292
predicate isDefault() { this.getPrefix() = "" }
287293

288-
/** Gets a printable representation of this XML namespace. */
289-
string toString() {
294+
override string toString() {
290295
this.isDefault() and result = this.getURI()
291296
or
292297
not this.isDefault() and result = this.getPrefix() + ":" + this.getURI()

0 commit comments

Comments
 (0)