View source: R/xml_nodes_to_lints.R
xml_nodes_to_lints | R Documentation |
Convenience function for converting nodes matched by XPath-based
linter logic into a Lint()
object to return.
xml_nodes_to_lints(
xml,
source_expression,
lint_message,
type = c("style", "warning", "error"),
column_number_xpath = range_start_xpath,
range_start_xpath = "number(./@col1)",
range_end_xpath = "number(./@col2)"
)
xml |
An |
source_expression |
A source expression object, e.g. as
returned typically by |
lint_message |
The message to be included as the |
type |
type of lint. |
column_number_xpath |
XPath expression to return the column number location of the lint.
Defaults to the start of the range matched by |
range_start_xpath |
XPath expression to return the range start location of the lint.
Defaults to the start of the expression matched by |
range_end_xpath |
XPath expression to return the range end location of the lint.
Defaults to the end of the expression matched by |
The location XPaths, column_number_xpath
, range_start_xpath
and range_end_xpath
are evaluated using
xml2::xml_find_num()
and will usually be of the form "number(./relative/xpath)"
.
Note that the location line number cannot be changed and lints spanning multiple lines will ignore range_end_xpath
.
column_number_xpath
and range_start_xpath
are assumed to always refer to locations on the starting line of the
xml
node.
For xml_node
s, a lint
. For xml_nodeset
s, lints
(a list of lint
s).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.