@@ -10,8 +10,11 @@ abstract class XMLLocatable extends @xmllocatable {
1010 Location getLocation ( ) { xmllocations ( this , result ) }
1111
1212 /**
13- * Holds if this element has the specified location information,
14- * including file path, start line, start column, end line and end column.
13+ * Holds if this element is at the specified location.
14+ * The location spans column `startcolumn` of line `startline` to
15+ * column `endcolumn` of line `endline` in file `filepath`.
16+ * For more information, see
17+ * [Locations](https://help.semmle.com/QL/learn-ql/ql/locations.html).
1518 */
1619 predicate hasLocationInfo (
1720 string filepath , int startline , int startcolumn , int endline , int endcolumn
@@ -22,7 +25,7 @@ abstract class XMLLocatable extends @xmllocatable {
2225 )
2326 }
2427
25- /** Gets a printable representation of this element. */
28+ /** Gets a textual representation of this element. */
2629 abstract string toString ( ) ;
2730}
2831
@@ -135,7 +138,17 @@ class XMLFile extends XMLParent, File {
135138 XMLDTD getADTD ( ) { xmlDTDs ( result , _, _, _, this ) }
136139}
137140
138- /** A "Document Type Definition" of an XML file. */
141+ /**
142+ * An XML document type definition (DTD).
143+ *
144+ * Example:
145+ *
146+ * ```
147+ * <!ELEMENT person (firstName, lastName?)>
148+ * <!ELEMENT firstName (#PCDATA)>
149+ * <!ELEMENT lastName (#PCDATA)>
150+ * ```
151+ */
139152class XMLDTD extends @xmldtd {
140153 /** Gets the name of the root element of this DTD. */
141154 string getRoot ( ) { xmlDTDs ( this , result , _, _, _) }
@@ -162,7 +175,17 @@ class XMLDTD extends @xmldtd {
162175 }
163176}
164177
165- /** An XML tag in an XML file. */
178+ /**
179+ * An XML element in an XML file.
180+ *
181+ * Example:
182+ *
183+ * ```
184+ * <manifest xmlns:android="http://schemas.android.com/apk/res/android"
185+ * package="com.example.exampleapp" android:versionCode="1">
186+ * </manifest>
187+ * ```
188+ */
166189class XMLElement extends @xmlelement, XMLParent , XMLLocatable {
167190 /** Holds if this XML element has the given `name`. */
168191 predicate hasName ( string name ) { name = getName ( ) }
@@ -207,7 +230,16 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable {
207230 override string toString ( ) { result = XMLParent .super .toString ( ) }
208231}
209232
210- /** An attribute that occurs inside an XML element. */
233+ /**
234+ * An attribute that occurs inside an XML element.
235+ *
236+ * Examples:
237+ *
238+ * ```
239+ * package="com.example.exampleapp"
240+ * android:versionCode="1"
241+ * ```
242+ */
211243class XMLAttribute extends @xmlattribute, XMLLocatable {
212244 /** Gets the name of this attribute. */
213245 string getName ( ) { xmlAttrs ( this , _, result , _, _, _) }
@@ -228,7 +260,15 @@ class XMLAttribute extends @xmlattribute, XMLLocatable {
228260 override string toString ( ) { result = this .getName ( ) + "=" + this .getValue ( ) }
229261}
230262
231- /** A namespace used in an XML file */
263+ /**
264+ * A namespace used in an XML file.
265+ *
266+ * Example:
267+ *
268+ * ```
269+ * xmlns:android="http://schemas.android.com/apk/res/android"
270+ * ```
271+ */
232272class XMLNamespace extends @xmlnamespace {
233273 /** Gets the prefix of this namespace. */
234274 string getPrefix ( ) { xmlNs ( this , result , _, _) }
@@ -247,7 +287,15 @@ class XMLNamespace extends @xmlnamespace {
247287 }
248288}
249289
250- /** A comment of the form `<!-- ... -->` is an XML comment. */
290+ /**
291+ * A comment in an XML file.
292+ *
293+ * Example:
294+ *
295+ * ```
296+ * <!-- This is a comment. -->
297+ * ```
298+ */
251299class XMLComment extends @xmlcomment, XMLLocatable {
252300 /** Gets the text content of this XML comment. */
253301 string getText ( ) { xmlComments ( this , result , _, _) }
@@ -262,6 +310,12 @@ class XMLComment extends @xmlcomment, XMLLocatable {
262310/**
263311 * A sequence of characters that occurs between opening and
264312 * closing tags of an XML element, excluding other elements.
313+ *
314+ * Example:
315+ *
316+ * ```
317+ * <content>This is a sequence of characters.</content>
318+ * ```
265319 */
266320class XMLCharacters extends @xmlcharacters, XMLLocatable {
267321 /** Gets the content of this character sequence. */
0 commit comments