Code Inspections in XPath
Inspection | Description | Default Severity |
---|---|---|
Check Node Test | This inspection checks whether any element/attribute names that are used in XPath-expressions are actually part of an associated XML file or are defined in a referenced schema. This helps to avoid problems caused by typos in XPath-expressions that would otherwise occur when running the script and may even then not be recognized immediately. Example: If the prefix "h" is bound to the XHTML namespace, the inspection will flag this part of the match-expression as an unknown element name because the correct name of the element is "textarea". | |
Implicit Type Conversion | This inspection checks for any implicit conversions between the predefined XPath-types STRING, NUMBER, BOOLEAN and NODESET. While this is usually not a problem as the conversions are well-defined by the standard, this inspection can help to write XSLT scripts that are more expressive about types and can even help to avoid subtle bugs: The first test checks whether the element "foo" exists ( There are several options to adjust the inspection to personal preferences by offering the possibility to individually enable it for implicit conversions between certain types. The plugin can also be told to always flag explicit conversions that do not result in the actually expected type, such as | |
Redundant Type Conversion | This inspection checks whether any type-conversion with the functions | |
Use of index 0 in XPath predicates | This inspection checks for any accidental use of zero in a predicate index or in a comparision with the function Example: | |
Hardwired Namespace Prefix | This inspection checks for comparisons of the Example: |