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