Class XpathUtil
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.utils.XpathUtil
-
public final class XpathUtil extends java.lang.ObjectContains utility methods for xpath.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetTextAttributeValue(DetailAST ast)Returns content of the text attribute of the ast element.static java.lang.StringprintXpathBranch(java.lang.String xpath, java.io.File file)Returns xpath query results on file as string.static booleansupportsTextAttribute(DetailAST ast)Checks, if specified node can have@textattribute.
-
-
-
Method Detail
-
supportsTextAttribute
public static boolean supportsTextAttribute(DetailAST ast)
Checks, if specified node can have@textattribute.- Parameters:
ast-DetailAstelement- Returns:
- true if element supports
@textattribute, false otherwise
-
getTextAttributeValue
public static java.lang.String getTextAttributeValue(DetailAST ast)
Returns content of the text attribute of the ast element.- Parameters:
ast-DetailAstelement- 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.IOExceptionReturns xpath query results on file as string.- Parameters:
xpath- query to evaluatefile- file to run on- Returns:
- all results as string separated by delimiter
- Throws:
CheckstyleException- if some parsing error happensjava.io.IOException- if an error occurs
-
-