Skip to content

Commit eadd85b

Browse files
authored
Merge pull request #10073 from erik-krogh/XMLXml
rename all occurrences of XML to Xml
2 parents aa0ff2b + 9c95dcc commit eadd85b

File tree

54 files changed

+462
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+462
-302
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
category: deprecated
3+
---
4+
* Classes/predicates that had upper-case acronym XML in their name have been renamed to Xml to follow our style-guide.
5+
The old name still exists as a deprecated alias.

cpp/ql/lib/semmle/code/cpp/XML.qll

Lines changed: 61 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ private class TXmlLocatable =
88
@xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters;
99

1010
/** An XML element that has a location. */
11-
class XMLLocatable extends @xmllocatable, TXmlLocatable {
11+
class XmlLocatable extends @xmllocatable, TXmlLocatable {
1212
/** Gets the source location for this element. */
1313
Location getLocation() { xmllocations(this, result) }
1414

@@ -32,13 +32,16 @@ class XMLLocatable extends @xmllocatable, TXmlLocatable {
3232
string toString() { none() } // overridden in subclasses
3333
}
3434

35+
/** DEPRECATED: Alias for XmlLocatable */
36+
deprecated class XMLLocatable = XmlLocatable;
37+
3538
/**
36-
* An `XMLParent` is either an `XMLElement` or an `XMLFile`,
39+
* An `XmlParent` is either an `XmlElement` or an `XmlFile`,
3740
* both of which can contain other elements.
3841
*/
39-
class XMLParent extends @xmlparent {
40-
XMLParent() {
41-
// explicitly restrict `this` to be either an `XMLElement` or an `XMLFile`;
42+
class XmlParent extends @xmlparent {
43+
XmlParent() {
44+
// explicitly restrict `this` to be either an `XmlElement` or an `XmlFile`;
4245
// the type `@xmlparent` currently also includes non-XML files
4346
this instanceof @xmlelement or xmlEncoding(this, _)
4447
}
@@ -50,28 +53,28 @@ class XMLParent extends @xmlparent {
5053
string getName() { none() } // overridden in subclasses
5154

5255
/** Gets the file to which this XML parent belongs. */
53-
XMLFile getFile() { result = this or xmlElements(this, _, _, _, result) }
56+
XmlFile getFile() { result = this or xmlElements(this, _, _, _, result) }
5457

5558
/** Gets the child element at a specified index of this XML parent. */
56-
XMLElement getChild(int index) { xmlElements(result, _, this, index, _) }
59+
XmlElement getChild(int index) { xmlElements(result, _, this, index, _) }
5760

5861
/** Gets a child element of this XML parent. */
59-
XMLElement getAChild() { xmlElements(result, _, this, _, _) }
62+
XmlElement getAChild() { xmlElements(result, _, this, _, _) }
6063

6164
/** Gets a child element of this XML parent with the given `name`. */
62-
XMLElement getAChild(string name) { xmlElements(result, _, this, _, _) and result.hasName(name) }
65+
XmlElement getAChild(string name) { xmlElements(result, _, this, _, _) and result.hasName(name) }
6366

6467
/** Gets a comment that is a child of this XML parent. */
65-
XMLComment getAComment() { xmlComments(result, _, this, _) }
68+
XmlComment getAComment() { xmlComments(result, _, this, _) }
6669

6770
/** Gets a character sequence that is a child of this XML parent. */
68-
XMLCharacters getACharactersSet() { xmlChars(result, _, this, _, _, _) }
71+
XmlCharacters getACharactersSet() { xmlChars(result, _, this, _, _, _) }
6972

70-
/** Gets the depth in the tree. (Overridden in XMLElement.) */
73+
/** Gets the depth in the tree. (Overridden in XmlElement.) */
7174
int getDepth() { result = 0 }
7275

7376
/** Gets the number of child XML elements of this XML parent. */
74-
int getNumberOfChildren() { result = count(XMLElement e | xmlElements(e, _, this, _, _)) }
77+
int getNumberOfChildren() { result = count(XmlElement e | xmlElements(e, _, this, _, _)) }
7578

7679
/** Gets the number of places in the body of this XML parent where text occurs. */
7780
int getNumberOfCharacterSets() { result = count(int pos | xmlChars(_, _, this, pos, _, _)) }
@@ -92,9 +95,12 @@ class XMLParent extends @xmlparent {
9295
string toString() { result = this.getName() }
9396
}
9497

98+
/** DEPRECATED: Alias for XmlParent */
99+
deprecated class XMLParent = XmlParent;
100+
95101
/** An XML file. */
96-
class XMLFile extends XMLParent, File {
97-
XMLFile() { xmlEncoding(this, _) }
102+
class XmlFile extends XmlParent, File {
103+
XmlFile() { xmlEncoding(this, _) }
98104

99105
/** Gets a printable representation of this XML file. */
100106
override string toString() { result = this.getName() }
@@ -120,15 +126,18 @@ class XMLFile extends XMLParent, File {
120126
string getEncoding() { xmlEncoding(this, result) }
121127

122128
/** Gets the XML file itself. */
123-
override XMLFile getFile() { result = this }
129+
override XmlFile getFile() { result = this }
124130

125131
/** Gets a top-most element in an XML file. */
126-
XMLElement getARootElement() { result = this.getAChild() }
132+
XmlElement getARootElement() { result = this.getAChild() }
127133

128134
/** Gets a DTD associated with this XML file. */
129-
XMLDTD getADTD() { xmlDTDs(result, _, _, _, this) }
135+
XmlDTD getADTD() { xmlDTDs(result, _, _, _, this) }
130136
}
131137

138+
/** DEPRECATED: Alias for XmlFile */
139+
deprecated class XMLFile = XmlFile;
140+
132141
/**
133142
* An XML document type definition (DTD).
134143
*
@@ -140,7 +149,7 @@ class XMLFile extends XMLParent, File {
140149
* <!ELEMENT lastName (#PCDATA)>
141150
* ```
142151
*/
143-
class XMLDTD extends XMLLocatable, @xmldtd {
152+
class XmlDTD extends XmlLocatable, @xmldtd {
144153
/** Gets the name of the root element of this DTD. */
145154
string getRoot() { xmlDTDs(this, result, _, _, _) }
146155

@@ -154,7 +163,7 @@ class XMLDTD extends XMLLocatable, @xmldtd {
154163
predicate isPublic() { not xmlDTDs(this, _, "", _, _) }
155164

156165
/** Gets the parent of this DTD. */
157-
XMLParent getParent() { xmlDTDs(this, _, _, _, result) }
166+
XmlParent getParent() { xmlDTDs(this, _, _, _, result) }
158167

159168
override string toString() {
160169
this.isPublic() and
@@ -165,6 +174,9 @@ class XMLDTD extends XMLLocatable, @xmldtd {
165174
}
166175
}
167176

177+
/** DEPRECATED: Alias for XmlDTD */
178+
deprecated class XMLDTD = XmlDTD;
179+
168180
/**
169181
* An XML element in an XML file.
170182
*
@@ -176,18 +188,18 @@ class XMLDTD extends XMLLocatable, @xmldtd {
176188
* </manifest>
177189
* ```
178190
*/
179-
class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
191+
class XmlElement extends @xmlelement, XmlParent, XmlLocatable {
180192
/** Holds if this XML element has the given `name`. */
181193
predicate hasName(string name) { name = this.getName() }
182194

183195
/** Gets the name of this XML element. */
184196
override string getName() { xmlElements(this, result, _, _, _) }
185197

186198
/** Gets the XML file in which this XML element occurs. */
187-
override XMLFile getFile() { xmlElements(this, _, _, _, result) }
199+
override XmlFile getFile() { xmlElements(this, _, _, _, result) }
188200

189201
/** Gets the parent of this XML element. */
190-
XMLParent getParent() { xmlElements(this, _, result, _, _) }
202+
XmlParent getParent() { xmlElements(this, _, result, _, _) }
191203

192204
/** Gets the index of this XML element among its parent's children. */
193205
int getIndex() { xmlElements(this, _, _, result, _) }
@@ -196,7 +208,7 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
196208
predicate hasNamespace() { xmlHasNs(this, _, _) }
197209

198210
/** Gets the namespace of this XML element, if any. */
199-
XMLNamespace getNamespace() { xmlHasNs(this, result, _) }
211+
XmlNamespace getNamespace() { xmlHasNs(this, result, _) }
200212

201213
/** Gets the index of this XML element among its parent's children. */
202214
int getElementPositionIndex() { xmlElements(this, _, _, result, _) }
@@ -205,10 +217,10 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
205217
override int getDepth() { result = this.getParent().getDepth() + 1 }
206218

207219
/** Gets an XML attribute of this XML element. */
208-
XMLAttribute getAnAttribute() { result.getElement() = this }
220+
XmlAttribute getAnAttribute() { result.getElement() = this }
209221

210222
/** Gets the attribute with the specified `name`, if any. */
211-
XMLAttribute getAttribute(string name) { result.getElement() = this and result.getName() = name }
223+
XmlAttribute getAttribute(string name) { result.getElement() = this and result.getName() = name }
212224

213225
/** Holds if this XML element has an attribute with the specified `name`. */
214226
predicate hasAttribute(string name) { exists(this.getAttribute(name)) }
@@ -220,6 +232,9 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
220232
override string toString() { result = this.getName() }
221233
}
222234

235+
/** DEPRECATED: Alias for XmlElement */
236+
deprecated class XMLElement = XmlElement;
237+
223238
/**
224239
* An attribute that occurs inside an XML element.
225240
*
@@ -230,18 +245,18 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
230245
* android:versionCode="1"
231246
* ```
232247
*/
233-
class XMLAttribute extends @xmlattribute, XMLLocatable {
248+
class XmlAttribute extends @xmlattribute, XmlLocatable {
234249
/** Gets the name of this attribute. */
235250
string getName() { xmlAttrs(this, _, result, _, _, _) }
236251

237252
/** Gets the XML element to which this attribute belongs. */
238-
XMLElement getElement() { xmlAttrs(this, result, _, _, _, _) }
253+
XmlElement getElement() { xmlAttrs(this, result, _, _, _, _) }
239254

240255
/** Holds if this attribute has a namespace. */
241256
predicate hasNamespace() { xmlHasNs(this, _, _) }
242257

243258
/** Gets the namespace of this attribute, if any. */
244-
XMLNamespace getNamespace() { xmlHasNs(this, result, _) }
259+
XmlNamespace getNamespace() { xmlHasNs(this, result, _) }
245260

246261
/** Gets the value of this attribute. */
247262
string getValue() { xmlAttrs(this, _, _, result, _, _) }
@@ -250,6 +265,9 @@ class XMLAttribute extends @xmlattribute, XMLLocatable {
250265
override string toString() { result = this.getName() + "=" + this.getValue() }
251266
}
252267

268+
/** DEPRECATED: Alias for XmlAttribute */
269+
deprecated class XMLAttribute = XmlAttribute;
270+
253271
/**
254272
* A namespace used in an XML file.
255273
*
@@ -259,7 +277,7 @@ class XMLAttribute extends @xmlattribute, XMLLocatable {
259277
* xmlns:android="http://schemas.android.com/apk/res/android"
260278
* ```
261279
*/
262-
class XMLNamespace extends XMLLocatable, @xmlnamespace {
280+
class XmlNamespace extends XmlLocatable, @xmlnamespace {
263281
/** Gets the prefix of this namespace. */
264282
string getPrefix() { xmlNs(this, result, _, _) }
265283

@@ -276,6 +294,9 @@ class XMLNamespace extends XMLLocatable, @xmlnamespace {
276294
}
277295
}
278296

297+
/** DEPRECATED: Alias for XmlNamespace */
298+
deprecated class XMLNamespace = XmlNamespace;
299+
279300
/**
280301
* A comment in an XML file.
281302
*
@@ -285,17 +306,20 @@ class XMLNamespace extends XMLLocatable, @xmlnamespace {
285306
* <!-- This is a comment. -->
286307
* ```
287308
*/
288-
class XMLComment extends @xmlcomment, XMLLocatable {
309+
class XmlComment extends @xmlcomment, XmlLocatable {
289310
/** Gets the text content of this XML comment. */
290311
string getText() { xmlComments(this, result, _, _) }
291312

292313
/** Gets the parent of this XML comment. */
293-
XMLParent getParent() { xmlComments(this, _, result, _) }
314+
XmlParent getParent() { xmlComments(this, _, result, _) }
294315

295316
/** Gets a printable representation of this XML comment. */
296317
override string toString() { result = this.getText() }
297318
}
298319

320+
/** DEPRECATED: Alias for XmlComment */
321+
deprecated class XMLComment = XmlComment;
322+
299323
/**
300324
* A sequence of characters that occurs between opening and
301325
* closing tags of an XML element, excluding other elements.
@@ -306,16 +330,19 @@ class XMLComment extends @xmlcomment, XMLLocatable {
306330
* <content>This is a sequence of characters.</content>
307331
* ```
308332
*/
309-
class XMLCharacters extends @xmlcharacters, XMLLocatable {
333+
class XmlCharacters extends @xmlcharacters, XmlLocatable {
310334
/** Gets the content of this character sequence. */
311335
string getCharacters() { xmlChars(this, result, _, _, _, _) }
312336

313337
/** Gets the parent of this character sequence. */
314-
XMLParent getParent() { xmlChars(this, _, result, _, _, _) }
338+
XmlParent getParent() { xmlChars(this, _, result, _, _, _) }
315339

316340
/** Holds if this character sequence is CDATA. */
317341
predicate isCDATA() { xmlChars(this, _, _, _, 1, _) }
318342

319343
/** Gets a printable representation of this XML character sequence. */
320344
override string toString() { result = this.getCharacters() }
321345
}
346+
347+
/** DEPRECATED: Alias for XmlCharacters */
348+
deprecated class XMLCharacters = XmlCharacters;

cpp/ql/test/library-tests/files/Files.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ string describe(File f) {
77
f.compiledAsCpp() and
88
result = "C++"
99
or
10-
f instanceof XMLParent and
10+
f instanceof XmlParent and
1111
result = "XMLParent" // regression tests a bug in the characteristic predicate of XMLParent
1212
}
1313

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
category: deprecated
3+
---
4+
* Classes/predicates that had upper-case acronym XML in their name have been renamed to Xml to follow our style-guide.
5+
The old name still exists as a deprecated alias.

csharp/ql/lib/semmle/code/asp/WebConfig.qll

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ import csharp
77
/**
88
* A `Web.config` file.
99
*/
10-
class WebConfigXml extends XMLFile {
10+
class WebConfigXml extends XmlFile {
1111
WebConfigXml() { this.getName().matches("%Web.config") }
1212
}
1313

1414
/** DEPRECATED: Alias for WebConfigXml */
1515
deprecated class WebConfigXML = WebConfigXml;
1616

1717
/** A `<configuration>` tag in an ASP.NET configuration file. */
18-
class ConfigurationXmlElement extends XMLElement {
18+
class ConfigurationXmlElement extends XmlElement {
1919
ConfigurationXmlElement() { this.getName().toLowerCase() = "configuration" }
2020
}
2121

2222
/** DEPRECATED: Alias for ConfigurationXmlElement */
2323
deprecated class ConfigurationXMLElement = ConfigurationXmlElement;
2424

2525
/** A `<location>` tag in an ASP.NET configuration file. */
26-
class LocationXmlElement extends XMLElement {
26+
class LocationXmlElement extends XmlElement {
2727
LocationXmlElement() {
2828
this.getParent() instanceof ConfigurationXmlElement and
2929
this.getName().toLowerCase() = "location"
@@ -34,7 +34,7 @@ class LocationXmlElement extends XMLElement {
3434
deprecated class LocationXMLElement = LocationXmlElement;
3535

3636
/** A `<system.web>` tag in an ASP.NET configuration file. */
37-
class SystemWebXmlElement extends XMLElement {
37+
class SystemWebXmlElement extends XmlElement {
3838
SystemWebXmlElement() {
3939
(
4040
this.getParent() instanceof ConfigurationXmlElement
@@ -49,7 +49,7 @@ class SystemWebXmlElement extends XMLElement {
4949
deprecated class SystemWebXMLElement = SystemWebXmlElement;
5050

5151
/** A `<system.webServer>` tag in an ASP.NET configuration file. */
52-
class SystemWebServerXmlElement extends XMLElement {
52+
class SystemWebServerXmlElement extends XmlElement {
5353
SystemWebServerXmlElement() {
5454
(
5555
this.getParent() instanceof ConfigurationXmlElement
@@ -64,7 +64,7 @@ class SystemWebServerXmlElement extends XMLElement {
6464
deprecated class SystemWebServerXMLElement = SystemWebServerXmlElement;
6565

6666
/** A `<customErrors>` tag in an ASP.NET configuration file. */
67-
class CustomErrorsXmlElement extends XMLElement {
67+
class CustomErrorsXmlElement extends XmlElement {
6868
CustomErrorsXmlElement() {
6969
this.getParent() instanceof SystemWebXmlElement and
7070
this.getName().toLowerCase() = "customerrors"
@@ -75,7 +75,7 @@ class CustomErrorsXmlElement extends XMLElement {
7575
deprecated class CustomErrorsXMLElement = CustomErrorsXmlElement;
7676

7777
/** A `<httpRuntime>` tag in an ASP.NET configuration file. */
78-
class HttpRuntimeXmlElement extends XMLElement {
78+
class HttpRuntimeXmlElement extends XmlElement {
7979
HttpRuntimeXmlElement() {
8080
this.getParent() instanceof SystemWebXmlElement and
8181
this.getName().toLowerCase() = "httpruntime"
@@ -86,7 +86,7 @@ class HttpRuntimeXmlElement extends XMLElement {
8686
deprecated class HttpRuntimeXMLElement = HttpRuntimeXmlElement;
8787

8888
/** A `<forms>` tag under `<system.web><authentication>` in an ASP.NET configuration file. */
89-
class FormsElement extends XMLElement {
89+
class FormsElement extends XmlElement {
9090
FormsElement() {
9191
this = any(SystemWebXmlElement sw).getAChild("authentication").getAChild("forms")
9292
}
@@ -105,7 +105,7 @@ class FormsElement extends XMLElement {
105105
}
106106

107107
/** A `<httpCookies>` tag in an ASP.NET configuration file. */
108-
class HttpCookiesElement extends XMLElement {
108+
class HttpCookiesElement extends XmlElement {
109109
HttpCookiesElement() { this = any(SystemWebXmlElement sw).getAChild("httpCookies") }
110110

111111
/**

0 commit comments

Comments
 (0)