@@ -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,12 +32,15 @@ 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 | 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() { |
| 42 | +class XmlParent extends @xmlparent { |
| 43 | + XmlParent() { |
41 | 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, _) |
@@ -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 | 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 |
@@ -176,18 +185,18 @@ class XMLDTD extends XMLLocatable, @xmldtd { |
176 | 185 | * </manifest> |
177 | 186 | * ``` |
178 | 187 | */ |
179 | | -class XMLElement extends @xmlelement, XMLParent, XMLLocatable { |
| 188 | +class XmlElement extends @xmlelement, XmlParent, XmlLocatable { |
180 | 189 | /** Holds if this XML element has the given `name`. */ |
181 | 190 | predicate hasName(string name) { name = this.getName() } |
182 | 191 |
|
183 | 192 | /** Gets the name of this XML element. */ |
184 | 193 | override string getName() { xmlElements(this, result, _, _, _) } |
185 | 194 |
|
186 | 195 | /** Gets the XML file in which this XML element occurs. */ |
187 | | - override XMLFile getFile() { xmlElements(this, _, _, _, result) } |
| 196 | + override XmlFile getFile() { xmlElements(this, _, _, _, result) } |
188 | 197 |
|
189 | 198 | /** Gets the parent of this XML element. */ |
190 | | - XMLParent getParent() { xmlElements(this, _, result, _, _) } |
| 199 | + XmlParent getParent() { xmlElements(this, _, result, _, _) } |
191 | 200 |
|
192 | 201 | /** Gets the index of this XML element among its parent's children. */ |
193 | 202 | int getIndex() { xmlElements(this, _, _, result, _) } |
@@ -196,7 +205,7 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable { |
196 | 205 | predicate hasNamespace() { xmlHasNs(this, _, _) } |
197 | 206 |
|
198 | 207 | /** Gets the namespace of this XML element, if any. */ |
199 | | - XMLNamespace getNamespace() { xmlHasNs(this, result, _) } |
| 208 | + XmlNamespace getNamespace() { xmlHasNs(this, result, _) } |
200 | 209 |
|
201 | 210 | /** Gets the index of this XML element among its parent's children. */ |
202 | 211 | int getElementPositionIndex() { xmlElements(this, _, _, result, _) } |
@@ -205,10 +214,10 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable { |
205 | 214 | override int getDepth() { result = this.getParent().getDepth() + 1 } |
206 | 215 |
|
207 | 216 | /** Gets an XML attribute of this XML element. */ |
208 | | - XMLAttribute getAnAttribute() { result.getElement() = this } |
| 217 | + XmlAttribute getAnAttribute() { result.getElement() = this } |
209 | 218 |
|
210 | 219 | /** 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 } |
212 | 221 |
|
213 | 222 | /** Holds if this XML element has an attribute with the specified `name`. */ |
214 | 223 | predicate hasAttribute(string name) { exists(this.getAttribute(name)) } |
@@ -220,6 +229,9 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable { |
220 | 229 | override string toString() { result = this.getName() } |
221 | 230 | } |
222 | 231 |
|
| 232 | +/** DEPRECATED: Alias for XmlElement */ |
| 233 | +deprecated class XMLElement = XmlElement; |
| 234 | + |
223 | 235 | /** |
224 | 236 | * An attribute that occurs inside an XML element. |
225 | 237 | * |
@@ -230,18 +242,18 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable { |
230 | 242 | * android:versionCode="1" |
231 | 243 | * ``` |
232 | 244 | */ |
233 | | -class XMLAttribute extends @xmlattribute, XMLLocatable { |
| 245 | +class XmlAttribute extends @xmlattribute, XmlLocatable { |
234 | 246 | /** Gets the name of this attribute. */ |
235 | 247 | string getName() { xmlAttrs(this, _, result, _, _, _) } |
236 | 248 |
|
237 | 249 | /** Gets the XML element to which this attribute belongs. */ |
238 | | - XMLElement getElement() { xmlAttrs(this, result, _, _, _, _) } |
| 250 | + XmlElement getElement() { xmlAttrs(this, result, _, _, _, _) } |
239 | 251 |
|
240 | 252 | /** Holds if this attribute has a namespace. */ |
241 | 253 | predicate hasNamespace() { xmlHasNs(this, _, _) } |
242 | 254 |
|
243 | 255 | /** Gets the namespace of this attribute, if any. */ |
244 | | - XMLNamespace getNamespace() { xmlHasNs(this, result, _) } |
| 256 | + XmlNamespace getNamespace() { xmlHasNs(this, result, _) } |
245 | 257 |
|
246 | 258 | /** Gets the value of this attribute. */ |
247 | 259 | string getValue() { xmlAttrs(this, _, _, result, _, _) } |
@@ -250,6 +262,9 @@ class XMLAttribute extends @xmlattribute, XMLLocatable { |
250 | 262 | override string toString() { result = this.getName() + "=" + this.getValue() } |
251 | 263 | } |
252 | 264 |
|
| 265 | +/** DEPRECATED: Alias for XmlAttribute */ |
| 266 | +deprecated class XMLAttribute = XmlAttribute; |
| 267 | + |
253 | 268 | /** |
254 | 269 | * A namespace used in an XML file. |
255 | 270 | * |
@@ -259,7 +274,7 @@ class XMLAttribute extends @xmlattribute, XMLLocatable { |
259 | 274 | * xmlns:android="http://schemas.android.com/apk/res/android" |
260 | 275 | * ``` |
261 | 276 | */ |
262 | | -class XMLNamespace extends XMLLocatable, @xmlnamespace { |
| 277 | +class XmlNamespace extends XmlLocatable, @xmlnamespace { |
263 | 278 | /** Gets the prefix of this namespace. */ |
264 | 279 | string getPrefix() { xmlNs(this, result, _, _) } |
265 | 280 |
|
@@ -276,6 +291,9 @@ class XMLNamespace extends XMLLocatable, @xmlnamespace { |
276 | 291 | } |
277 | 292 | } |
278 | 293 |
|
| 294 | +/** DEPRECATED: Alias for XmlNamespace */ |
| 295 | +deprecated class XMLNamespace = XmlNamespace; |
| 296 | + |
279 | 297 | /** |
280 | 298 | * A comment in an XML file. |
281 | 299 | * |
@@ -285,17 +303,20 @@ class XMLNamespace extends XMLLocatable, @xmlnamespace { |
285 | 303 | * <!-- This is a comment. --> |
286 | 304 | * ``` |
287 | 305 | */ |
288 | | -class XMLComment extends @xmlcomment, XMLLocatable { |
| 306 | +class XmlComment extends @xmlcomment, XmlLocatable { |
289 | 307 | /** Gets the text content of this XML comment. */ |
290 | 308 | string getText() { xmlComments(this, result, _, _) } |
291 | 309 |
|
292 | 310 | /** Gets the parent of this XML comment. */ |
293 | | - XMLParent getParent() { xmlComments(this, _, result, _) } |
| 311 | + XmlParent getParent() { xmlComments(this, _, result, _) } |
294 | 312 |
|
295 | 313 | /** Gets a printable representation of this XML comment. */ |
296 | 314 | override string toString() { result = this.getText() } |
297 | 315 | } |
298 | 316 |
|
| 317 | +/** DEPRECATED: Alias for XmlComment */ |
| 318 | +deprecated class XMLComment = XmlComment; |
| 319 | + |
299 | 320 | /** |
300 | 321 | * A sequence of characters that occurs between opening and |
301 | 322 | * closing tags of an XML element, excluding other elements. |
@@ -306,16 +327,19 @@ class XMLComment extends @xmlcomment, XMLLocatable { |
306 | 327 | * <content>This is a sequence of characters.</content> |
307 | 328 | * ``` |
308 | 329 | */ |
309 | | -class XMLCharacters extends @xmlcharacters, XMLLocatable { |
| 330 | +class XmlCharacters extends @xmlcharacters, XmlLocatable { |
310 | 331 | /** Gets the content of this character sequence. */ |
311 | 332 | string getCharacters() { xmlChars(this, result, _, _, _, _) } |
312 | 333 |
|
313 | 334 | /** Gets the parent of this character sequence. */ |
314 | | - XMLParent getParent() { xmlChars(this, _, result, _, _, _) } |
| 335 | + XmlParent getParent() { xmlChars(this, _, result, _, _, _) } |
315 | 336 |
|
316 | 337 | /** Holds if this character sequence is CDATA. */ |
317 | 338 | predicate isCDATA() { xmlChars(this, _, _, _, 1, _) } |
318 | 339 |
|
319 | 340 | /** Gets a printable representation of this XML character sequence. */ |
320 | 341 | override string toString() { result = this.getCharacters() } |
321 | 342 | } |
| 343 | + |
| 344 | +/** DEPRECATED: Alias for XmlCharacters */ |
| 345 | +deprecated class XMLCharacters = XmlCharacters; |