@@ -8,7 +8,7 @@ private class TXmlLocatable =
8
8
@xmldtd or @xmlelement or @xmlattribute or @xmlnamespace or @xmlcomment or @xmlcharacters;
9
9
10
10
/** An XML element that has a location. */
11
- class XMLLocatable extends @xmllocatable, TXmlLocatable {
11
+ class XmlLocatable extends @xmllocatable, TXmlLocatable {
12
12
/** Gets the source location for this element. */
13
13
Location getLocation ( ) { xmllocations ( this , result ) }
14
14
@@ -32,13 +32,16 @@ class XMLLocatable extends @xmllocatable, TXmlLocatable {
32
32
string toString ( ) { none ( ) } // overridden in subclasses
33
33
}
34
34
35
+ /** DEPRECATED: Alias for XmlLocatable */
36
+ deprecated class XMLLocatable = XmlLocatable ;
37
+
35
38
/**
36
- * An `XMLParent ` is either an `XMLElement ` or an `XMLFile `,
39
+ * An `XmlParent ` is either an `XmlElement ` or an `XmlFile `,
37
40
* both of which can contain other elements.
38
41
*/
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 `;
42
45
// the type `@xmlparent` currently also includes non-XML files
43
46
this instanceof @xmlelement or xmlEncoding ( this , _)
44
47
}
@@ -50,28 +53,28 @@ class XMLParent extends @xmlparent {
50
53
string getName ( ) { none ( ) } // overridden in subclasses
51
54
52
55
/** 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 ) }
54
57
55
58
/** 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 , _) }
57
60
58
61
/** Gets a child element of this XML parent. */
59
- XMLElement getAChild ( ) { xmlElements ( result , _, this , _, _) }
62
+ XmlElement getAChild ( ) { xmlElements ( result , _, this , _, _) }
60
63
61
64
/** 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 ) }
63
66
64
67
/** Gets a comment that is a child of this XML parent. */
65
- XMLComment getAComment ( ) { xmlComments ( result , _, this , _) }
68
+ XmlComment getAComment ( ) { xmlComments ( result , _, this , _) }
66
69
67
70
/** Gets a character sequence that is a child of this XML parent. */
68
- XMLCharacters getACharactersSet ( ) { xmlChars ( result , _, this , _, _, _) }
71
+ XmlCharacters getACharactersSet ( ) { xmlChars ( result , _, this , _, _, _) }
69
72
70
- /** Gets the depth in the tree. (Overridden in XMLElement .) */
73
+ /** Gets the depth in the tree. (Overridden in XmlElement .) */
71
74
int getDepth ( ) { result = 0 }
72
75
73
76
/** 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 , _, _) ) }
75
78
76
79
/** Gets the number of places in the body of this XML parent where text occurs. */
77
80
int getNumberOfCharacterSets ( ) { result = count ( int pos | xmlChars ( _, _, this , pos , _, _) ) }
@@ -92,9 +95,12 @@ class XMLParent extends @xmlparent {
92
95
string toString ( ) { result = this .getName ( ) }
93
96
}
94
97
98
+ /** DEPRECATED: Alias for XmlParent */
99
+ deprecated class XMLParent = XmlParent ;
100
+
95
101
/** An XML file. */
96
- class XMLFile extends XMLParent , File {
97
- XMLFile ( ) { xmlEncoding ( this , _) }
102
+ class XmlFile extends XmlParent , File {
103
+ XmlFile ( ) { xmlEncoding ( this , _) }
98
104
99
105
/** Gets a printable representation of this XML file. */
100
106
override string toString ( ) { result = this .getName ( ) }
@@ -120,15 +126,18 @@ class XMLFile extends XMLParent, File {
120
126
string getEncoding ( ) { xmlEncoding ( this , result ) }
121
127
122
128
/** Gets the XML file itself. */
123
- override XMLFile getFile ( ) { result = this }
129
+ override XmlFile getFile ( ) { result = this }
124
130
125
131
/** Gets a top-most element in an XML file. */
126
- XMLElement getARootElement ( ) { result = this .getAChild ( ) }
132
+ XmlElement getARootElement ( ) { result = this .getAChild ( ) }
127
133
128
134
/** Gets a DTD associated with this XML file. */
129
- XMLDTD getADTD ( ) { xmlDTDs ( result , _, _, _, this ) }
135
+ XmlDTD getADTD ( ) { xmlDTDs ( result , _, _, _, this ) }
130
136
}
131
137
138
+ /** DEPRECATED: Alias for XmlFile */
139
+ deprecated class XMLFile = XmlFile ;
140
+
132
141
/**
133
142
* An XML document type definition (DTD).
134
143
*
@@ -140,7 +149,7 @@ class XMLFile extends XMLParent, File {
140
149
* <!ELEMENT lastName (#PCDATA)>
141
150
* ```
142
151
*/
143
- class XMLDTD extends XMLLocatable , @xmldtd {
152
+ class XmlDTD extends XmlLocatable , @xmldtd {
144
153
/** Gets the name of the root element of this DTD. */
145
154
string getRoot ( ) { xmlDTDs ( this , result , _, _, _) }
146
155
@@ -154,7 +163,7 @@ class XMLDTD extends XMLLocatable, @xmldtd {
154
163
predicate isPublic ( ) { not xmlDTDs ( this , _, "" , _, _) }
155
164
156
165
/** Gets the parent of this DTD. */
157
- XMLParent getParent ( ) { xmlDTDs ( this , _, _, _, result ) }
166
+ XmlParent getParent ( ) { xmlDTDs ( this , _, _, _, result ) }
158
167
159
168
override string toString ( ) {
160
169
this .isPublic ( ) and
@@ -165,6 +174,9 @@ class XMLDTD extends XMLLocatable, @xmldtd {
165
174
}
166
175
}
167
176
177
+ /** DEPRECATED: Alias for XmlDTD */
178
+ deprecated class XMLDTD = XmlDTD ;
179
+
168
180
/**
169
181
* An XML element in an XML file.
170
182
*
@@ -176,18 +188,18 @@ class XMLDTD extends XMLLocatable, @xmldtd {
176
188
* </manifest>
177
189
* ```
178
190
*/
179
- class XMLElement extends @xmlelement, XMLParent , XMLLocatable {
191
+ class XmlElement extends @xmlelement, XmlParent , XmlLocatable {
180
192
/** Holds if this XML element has the given `name`. */
181
193
predicate hasName ( string name ) { name = this .getName ( ) }
182
194
183
195
/** Gets the name of this XML element. */
184
196
override string getName ( ) { xmlElements ( this , result , _, _, _) }
185
197
186
198
/** Gets the XML file in which this XML element occurs. */
187
- override XMLFile getFile ( ) { xmlElements ( this , _, _, _, result ) }
199
+ override XmlFile getFile ( ) { xmlElements ( this , _, _, _, result ) }
188
200
189
201
/** Gets the parent of this XML element. */
190
- XMLParent getParent ( ) { xmlElements ( this , _, result , _, _) }
202
+ XmlParent getParent ( ) { xmlElements ( this , _, result , _, _) }
191
203
192
204
/** Gets the index of this XML element among its parent's children. */
193
205
int getIndex ( ) { xmlElements ( this , _, _, result , _) }
@@ -196,7 +208,7 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
196
208
predicate hasNamespace ( ) { xmlHasNs ( this , _, _) }
197
209
198
210
/** Gets the namespace of this XML element, if any. */
199
- XMLNamespace getNamespace ( ) { xmlHasNs ( this , result , _) }
211
+ XmlNamespace getNamespace ( ) { xmlHasNs ( this , result , _) }
200
212
201
213
/** Gets the index of this XML element among its parent's children. */
202
214
int getElementPositionIndex ( ) { xmlElements ( this , _, _, result , _) }
@@ -205,10 +217,10 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
205
217
override int getDepth ( ) { result = this .getParent ( ) .getDepth ( ) + 1 }
206
218
207
219
/** Gets an XML attribute of this XML element. */
208
- XMLAttribute getAnAttribute ( ) { result .getElement ( ) = this }
220
+ XmlAttribute getAnAttribute ( ) { result .getElement ( ) = this }
209
221
210
222
/** 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 }
212
224
213
225
/** Holds if this XML element has an attribute with the specified `name`. */
214
226
predicate hasAttribute ( string name ) { exists ( this .getAttribute ( name ) ) }
@@ -220,6 +232,9 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
220
232
override string toString ( ) { result = this .getName ( ) }
221
233
}
222
234
235
+ /** DEPRECATED: Alias for XmlElement */
236
+ deprecated class XMLElement = XmlElement ;
237
+
223
238
/**
224
239
* An attribute that occurs inside an XML element.
225
240
*
@@ -230,18 +245,18 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
230
245
* android:versionCode="1"
231
246
* ```
232
247
*/
233
- class XMLAttribute extends @xmlattribute, XMLLocatable {
248
+ class XmlAttribute extends @xmlattribute, XmlLocatable {
234
249
/** Gets the name of this attribute. */
235
250
string getName ( ) { xmlAttrs ( this , _, result , _, _, _) }
236
251
237
252
/** Gets the XML element to which this attribute belongs. */
238
- XMLElement getElement ( ) { xmlAttrs ( this , result , _, _, _, _) }
253
+ XmlElement getElement ( ) { xmlAttrs ( this , result , _, _, _, _) }
239
254
240
255
/** Holds if this attribute has a namespace. */
241
256
predicate hasNamespace ( ) { xmlHasNs ( this , _, _) }
242
257
243
258
/** Gets the namespace of this attribute, if any. */
244
- XMLNamespace getNamespace ( ) { xmlHasNs ( this , result , _) }
259
+ XmlNamespace getNamespace ( ) { xmlHasNs ( this , result , _) }
245
260
246
261
/** Gets the value of this attribute. */
247
262
string getValue ( ) { xmlAttrs ( this , _, _, result , _, _) }
@@ -250,6 +265,9 @@ class XMLAttribute extends @xmlattribute, XMLLocatable {
250
265
override string toString ( ) { result = this .getName ( ) + "=" + this .getValue ( ) }
251
266
}
252
267
268
+ /** DEPRECATED: Alias for XmlAttribute */
269
+ deprecated class XMLAttribute = XmlAttribute ;
270
+
253
271
/**
254
272
* A namespace used in an XML file.
255
273
*
@@ -259,7 +277,7 @@ class XMLAttribute extends @xmlattribute, XMLLocatable {
259
277
* xmlns:android="http://schemas.android.com/apk/res/android"
260
278
* ```
261
279
*/
262
- class XMLNamespace extends XMLLocatable , @xmlnamespace {
280
+ class XmlNamespace extends XmlLocatable , @xmlnamespace {
263
281
/** Gets the prefix of this namespace. */
264
282
string getPrefix ( ) { xmlNs ( this , result , _, _) }
265
283
@@ -276,6 +294,9 @@ class XMLNamespace extends XMLLocatable, @xmlnamespace {
276
294
}
277
295
}
278
296
297
+ /** DEPRECATED: Alias for XmlNamespace */
298
+ deprecated class XMLNamespace = XmlNamespace ;
299
+
279
300
/**
280
301
* A comment in an XML file.
281
302
*
@@ -285,17 +306,20 @@ class XMLNamespace extends XMLLocatable, @xmlnamespace {
285
306
* <!-- This is a comment. -->
286
307
* ```
287
308
*/
288
- class XMLComment extends @xmlcomment, XMLLocatable {
309
+ class XmlComment extends @xmlcomment, XmlLocatable {
289
310
/** Gets the text content of this XML comment. */
290
311
string getText ( ) { xmlComments ( this , result , _, _) }
291
312
292
313
/** Gets the parent of this XML comment. */
293
- XMLParent getParent ( ) { xmlComments ( this , _, result , _) }
314
+ XmlParent getParent ( ) { xmlComments ( this , _, result , _) }
294
315
295
316
/** Gets a printable representation of this XML comment. */
296
317
override string toString ( ) { result = this .getText ( ) }
297
318
}
298
319
320
+ /** DEPRECATED: Alias for XmlComment */
321
+ deprecated class XMLComment = XmlComment ;
322
+
299
323
/**
300
324
* A sequence of characters that occurs between opening and
301
325
* closing tags of an XML element, excluding other elements.
@@ -306,16 +330,19 @@ class XMLComment extends @xmlcomment, XMLLocatable {
306
330
* <content>This is a sequence of characters.</content>
307
331
* ```
308
332
*/
309
- class XMLCharacters extends @xmlcharacters, XMLLocatable {
333
+ class XmlCharacters extends @xmlcharacters, XmlLocatable {
310
334
/** Gets the content of this character sequence. */
311
335
string getCharacters ( ) { xmlChars ( this , result , _, _, _, _) }
312
336
313
337
/** Gets the parent of this character sequence. */
314
- XMLParent getParent ( ) { xmlChars ( this , _, result , _, _, _) }
338
+ XmlParent getParent ( ) { xmlChars ( this , _, result , _, _, _) }
315
339
316
340
/** Holds if this character sequence is CDATA. */
317
341
predicate isCDATA ( ) { xmlChars ( this , _, _, _, 1 , _) }
318
342
319
343
/** Gets a printable representation of this XML character sequence. */
320
344
override string toString ( ) { result = this .getCharacters ( ) }
321
345
}
346
+
347
+ /** DEPRECATED: Alias for XmlCharacters */
348
+ deprecated class XMLCharacters = XmlCharacters ;
0 commit comments