Class XpathUtil


  • public final class XpathUtil
    extends java.lang.Object
    Contains utility methods for xpath.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getTextAttributeValue​(DetailAST ast)
      Returns content of the text attribute of the ast element.
      static java.lang.String printXpathBranch​(java.lang.String xpath, java.io.File file)
      Returns xpath query results on file as string.
      static boolean supportsTextAttribute​(DetailAST ast)
      Checks, if specified node can have @text attribute.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • supportsTextAttribute

        public static boolean supportsTextAttribute​(DetailAST ast)
        Checks, if specified node can have @text attribute.
        Parameters:
        ast - DetailAst element
        Returns:
        true if element supports @text attribute, false otherwise
      • getTextAttributeValue

        public static java.lang.String getTextAttributeValue​(DetailAST ast)
        Returns content of the text attribute of the ast element.
        Parameters:
        ast - DetailAst element
        Returns:
        text attribute of the ast element
      • printXpathBranch

        public static java.lang.String printXpathBranch​(java.lang.String xpath,
                                                        java.io.File file)
                                                 throws CheckstyleException,
                                                        java.io.IOException
        Returns xpath query results on file as string.
        Parameters:
        xpath - query to evaluate
        file - file to run on
        Returns:
        all results as string separated by delimiter
        Throws:
        CheckstyleException - if some parsing error happens
        java.io.IOException - if an error occurs