Skip to content

Commit ce9f69a

Browse files
committed
rename all occurrences of XML to Xml
1 parent 72c2040 commit ce9f69a

File tree

49 files changed

+407
-287
lines changed

Some content is hidden

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

49 files changed

+407
-287
lines changed

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

+55-31
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,12 +32,15 @@ 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
/**
3639
* 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() {
42+
class XmlParent extends @xmlparent {
43+
XmlParent() {
4144
// 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, _)
@@ -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. */
129135
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
@@ -176,18 +185,18 @@ class XMLDTD extends XMLLocatable, @xmldtd {
176185
* </manifest>
177186
* ```
178187
*/
179-
class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
188+
class XmlElement extends @xmlelement, XmlParent, XmlLocatable {
180189
/** Holds if this XML element has the given `name`. */
181190
predicate hasName(string name) { name = this.getName() }
182191

183192
/** Gets the name of this XML element. */
184193
override string getName() { xmlElements(this, result, _, _, _) }
185194

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

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

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

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

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

207216
/** Gets an XML attribute of this XML element. */
208-
XMLAttribute getAnAttribute() { result.getElement() = this }
217+
XmlAttribute getAnAttribute() { result.getElement() = this }
209218

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

213222
/** Holds if this XML element has an attribute with the specified `name`. */
214223
predicate hasAttribute(string name) { exists(this.getAttribute(name)) }
@@ -220,6 +229,9 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
220229
override string toString() { result = this.getName() }
221230
}
222231

232+
/** DEPRECATED: Alias for XmlElement */
233+
deprecated class XMLElement = XmlElement;
234+
223235
/**
224236
* An attribute that occurs inside an XML element.
225237
*
@@ -230,18 +242,18 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
230242
* android:versionCode="1"
231243
* ```
232244
*/
233-
class XMLAttribute extends @xmlattribute, XMLLocatable {
245+
class XmlAttribute extends @xmlattribute, XmlLocatable {
234246
/** Gets the name of this attribute. */
235247
string getName() { xmlAttrs(this, _, result, _, _, _) }
236248

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

240252
/** Holds if this attribute has a namespace. */
241253
predicate hasNamespace() { xmlHasNs(this, _, _) }
242254

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

246258
/** Gets the value of this attribute. */
247259
string getValue() { xmlAttrs(this, _, _, result, _, _) }
@@ -250,6 +262,9 @@ class XMLAttribute extends @xmlattribute, XMLLocatable {
250262
override string toString() { result = this.getName() + "=" + this.getValue() }
251263
}
252264

265+
/** DEPRECATED: Alias for XmlAttribute */
266+
deprecated class XMLAttribute = XmlAttribute;
267+
253268
/**
254269
* A namespace used in an XML file.
255270
*
@@ -259,7 +274,7 @@ class XMLAttribute extends @xmlattribute, XMLLocatable {
259274
* xmlns:android="http://schemas.android.com/apk/res/android"
260275
* ```
261276
*/
262-
class XMLNamespace extends XMLLocatable, @xmlnamespace {
277+
class XmlNamespace extends XmlLocatable, @xmlnamespace {
263278
/** Gets the prefix of this namespace. */
264279
string getPrefix() { xmlNs(this, result, _, _) }
265280

@@ -276,6 +291,9 @@ class XMLNamespace extends XMLLocatable, @xmlnamespace {
276291
}
277292
}
278293

294+
/** DEPRECATED: Alias for XmlNamespace */
295+
deprecated class XMLNamespace = XmlNamespace;
296+
279297
/**
280298
* A comment in an XML file.
281299
*
@@ -285,17 +303,20 @@ class XMLNamespace extends XMLLocatable, @xmlnamespace {
285303
* <!-- This is a comment. -->
286304
* ```
287305
*/
288-
class XMLComment extends @xmlcomment, XMLLocatable {
306+
class XmlComment extends @xmlcomment, XmlLocatable {
289307
/** Gets the text content of this XML comment. */
290308
string getText() { xmlComments(this, result, _, _) }
291309

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

295313
/** Gets a printable representation of this XML comment. */
296314
override string toString() { result = this.getText() }
297315
}
298316

317+
/** DEPRECATED: Alias for XmlComment */
318+
deprecated class XMLComment = XmlComment;
319+
299320
/**
300321
* A sequence of characters that occurs between opening and
301322
* closing tags of an XML element, excluding other elements.
@@ -306,16 +327,19 @@ class XMLComment extends @xmlcomment, XMLLocatable {
306327
* <content>This is a sequence of characters.</content>
307328
* ```
308329
*/
309-
class XMLCharacters extends @xmlcharacters, XMLLocatable {
330+
class XmlCharacters extends @xmlcharacters, XmlLocatable {
310331
/** Gets the content of this character sequence. */
311332
string getCharacters() { xmlChars(this, result, _, _, _, _) }
312333

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

316337
/** Holds if this character sequence is CDATA. */
317338
predicate isCDATA() { xmlChars(this, _, _, _, 1, _) }
318339

319340
/** Gets a printable representation of this XML character sequence. */
320341
override string toString() { result = this.getCharacters() }
321342
}
343+
344+
/** DEPRECATED: Alias for XmlCharacters */
345+
deprecated class XMLCharacters = XmlCharacters;

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

+1-1
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

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

+9-9
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)