## net.sourceforge.pmd.rules
Class XPathRule

    java.lang.Object
      net.sourceforge.pmd.CommonAbstractRule
          net.sourceforge.pmd.rules.XPathRule

All Implemented Interfaces:
  Rule

public class XPathRule
extends CommonAbstractRule

Rule that tries to match an XPath expression against a DOM view of the AST of a "compilation unit".

This rule needs a property "xpath".

Field Summary

Fields inherited from class net.sourceforge.pmd.CommonAbstractRule
`description, example, externalInfoUrl, include, message, name, priority, properties, ruleSetName, usesDFA`

Fields inherited from interface net.sourceforge.pmd.Rule
`LOWEST_PRIORITY, PRIORITIES`

Constructor Summary
`XPathRule()`

Method Summary
`void` `apply(java.util.List astCompilationUnits, RuleContext ctx)` Apply the rule to all compilation units.
`void` `evaluate(Node compilationUnit, RuleContext data)` Evaluate the AST with compilationUnit as root-node, against the XPath expression found as property with name "xpath".

Methods inherited from class net.sourceforge.pmd.CommonAbstractRule

`addProperties, addProperty, addViolation, addViolation, addViolation, addViolationWithMessage, equals, getBooleanProperty, getDescription, getDoubleProperty, getExample, getExternalInfoUrl, getIntProperty, getMessage, getName, getPriority, getPriorityName, getProperties, getRuleSetName, getStringProperty, hashCode, hasProperty, include, setDescription, setExample, setExternalInfoUrl, setInclude, setMessage, setName, setPriority, setRuleSetName, setUsesDFA, usesDFA`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XPathRule

    public XPathRule()

Method Detail

### evaluate

    public void evaluate(Node compilationUnit,
                         RuleContext data)

  Evaluate the AST with compilationUnit as root-node, against the XPath expression found as property with name "xpath". All matches are reported as violations.

  Parameters:
    `compilationUnit` - the Node that is the root of the AST to be checked
    `data` -
  Returns:

### apply

    public void apply(java.util.List astCompilationUnits,
                      RuleContext ctx)

  Apply the rule to all compilation units.

Copyright © 2002-2006 InfoEther. All Rights Reserved.