Class XpathUtil
java.lang.Object
com.puppycrawl.tools.checkstyle.utils.XpathUtil
Contains utility methods for xpath.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns content of the text attribute of the ast element.static StringprintXpathBranch(String xpath, File file) Returns xpath query results on file as string.static booleanChecks, if specified node can have@textattribute.
-
Method Details
-
supportsTextAttribute
Checks, if specified node can have@textattribute.- Parameters:
ast-DetailAstelement- Returns:
- true if element supports
@textattribute, false otherwise
-
getTextAttributeValue
Returns content of the text attribute of the ast element.- Parameters:
ast-DetailAstelement- Returns:
- text attribute of the ast element
-
printXpathBranch
public static String printXpathBranch(String xpath, File file) throws CheckstyleException, IOException Returns 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 happensIOException- if an error occurs
-