Skip to content

[doc] How to implement a custom XPath function for a language #4807

@adangel

Description

@adangel

PMD provides a couple of custom XPath functions, that can be called, see
https://docs.pmd-code.org/latest/pmd_userdocs_extending_writing_xpath_rules.html#pmd-extension-functions

However, there is no documentation available yet, that describes, how to implement/add such a custom function for your own language or for existing languages.
It should be added e.g. here https://docs.pmd-code.org/snapshot/pmd_devdocs_major_adding_new_language_javacc.html#xpath-integration

Important classes:

  • net.sourceforge.pmd.lang.rule.xpath.impl.XPathHandler
  • net.sourceforge.pmd.lang.rule.xpath.impl.XPathFunctionDefinition

Related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    an:enhancementAn improvement on existing features / rulesin:documentationAffects the documentation [doc]

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions