Detect Attribute (detectAttribute)
<detectAttribute> Element
The detectAttribute rule is used to find attributes that are specified in xml files.
| Attribute Name | Type | Required | Description |
|---|---|---|---|
| tags | String | No |
The element name on which the attribute is specified. If providing multiple, use a comma separated list. If not specified, will match any element that meets the other criteria for the rule. |
| attributeName | String/Regex | Yes |
The attribute name. |
| attributeValue | String/Regex | No |
The value of the attribute. |
| namespace | Regex | No |
Only flag results if the URI of the namespace the element belongs to matches this pattern. If the pattern is "*", flag elements in any namespace, including elements with no namespace specified. Defaults to "*". This is for the elements specified by tags attribute. |
| attributeNamespace | Regex | No |
Only flag results if the URI of the namespace the attribute belongs to matches this pattern. If the pattern is "*", flag attributes in any namespace, including attributes with no namespace specified. Defaults to "*". This is for the attribute specified by attributeName. |
| documentNamespace | Regex | No |
Only flag results if the document namespace for the file matches this namespace pattern. Results will not be flagged in any file that does not have a document namespace specified. If both documentNamespace and validateDocumentNamespace are specified, documentNamespace is used. |
| validateDocumentNamespace | Regex | No |
Flag results if the document namespace for the file does not match this namespace pattern, and in any file that does not have a document namespace specified. Use this attribute to flag XML files that don't conform to a specific document namespace. If both documentNamespace and validateDocumentNamespace are specified, documentNamespace is used. |
| xmlFileType | Enumeration | No |
Type of XML file. The supported values are:
|
| flagIfAttributeMissing | Boolean | No |
If set to true, flag elements matching tags only if they do not have an attribute matching attributeName. Defaults to false. |
| flagOnce | Boolean | No |
Indicates whether to flag once per archive. Defaults to false. |
| flagOncePerFile | Boolean | No |
Indicates whether to flag once per file. Defaults to false. |
| hideResult | Boolean | No |
Indicates whether results flagged by this rule should be hidden in the report. This attribute only hides results when used with rules under the <and> or <or> tags. Defaults to false. |
Child Elements (One or more)
<xmlFile> Element - required, can be multiple
| Attribute Name | Type | Required | Description |
|---|---|---|---|
| pattern | Regex | Yes |
File name with or without path. |
For example, to detect a localTransaction attribute on a boundary element with a value of ActivitySession in a META-INF/ibm-ejb-jar-ext.xml, specify:
<detectAttribute tags="localTransaction" attributeName="boundary" attributeValue="ActivitySession">
<xmlFile pattern="META-INF/ibm-ejb-jar-ext.xml"/>
</detectAttribute>