1313# ' @param search For `xml_child`, either the child number to return (by
1414# ' position), or the name of the child node to return. If there are multiple
1515# ' child nodes with the same name, the first will be returned
16+ # ' @param ... Additional options passed to internal functions.
1617# ' @return A node or nodeset (possibly empty). Results are always de-duplicated.
1718# ' @export
1819# ' @examples
2425# ' # Note the each unique node only appears once in the output
2526# ' xml_parent(xml_children(x))
2627# '
28+ # ' # But you avoid this deduplication if needed
29+ # ' xml_parent(xml_children(x), deduplicate = FALSE)
30+ # '
2731# ' # Mixed content
2832# ' x <- read_xml("<foo> a <b/> c <d>e</d> f</foo>")
2933# ' # Childen gets the elements, contents gets all node types
3741# ' xml_child(x)
3842# ' xml_child(x, 2)
3943# ' xml_child(x, "baz")
40- xml_children <- function (x ) {
41- nodeset_apply(x , function (x ) .Call(node_children , x , TRUE ))
44+ xml_children <- function (x , ... ) {
45+ nodeset_apply(x , function (x ) .Call(node_children , x , TRUE ), ... )
4246}
4347
4448# ' @export
@@ -65,8 +69,8 @@ xml_contents <- function(x) {
6569
6670# ' @export
6771# ' @rdname xml_children
68- xml_parents <- function (x ) {
69- nodeset_apply(x , function (x ) .Call(node_parents , x ))
72+ xml_parents <- function (x , ... ) {
73+ nodeset_apply(x , function (x ) .Call(node_parents , x ), ... )
7074}
7175
7276# ' @export
@@ -77,23 +81,23 @@ xml_siblings <- function(x) {
7781
7882# ' @export
7983# ' @rdname xml_children
80- xml_parent <- function (x ) {
84+ xml_parent <- function (x , ... ) {
8185 UseMethod(" xml_parent" )
8286}
8387
8488# ' @export
85- xml_parent.xml_missing <- function (x ) {
89+ xml_parent.xml_missing <- function (x , ... ) {
8690 xml_missing()
8791}
8892
8993# ' @export
90- xml_parent.xml_node <- function (x ) {
94+ xml_parent.xml_node <- function (x , ... ) {
9195 xml_node(.Call(node_parent , x $ node ), x $ doc )
9296}
9397
9498# ' @export
95- xml_parent.xml_nodeset <- function (x ) {
96- nodeset_apply(x , function (x ) .Call(node_parent , x ))
99+ xml_parent.xml_nodeset <- function (x , ... ) {
100+ nodeset_apply(x , function (x ) .Call(node_parent , x ), ... )
97101}
98102
99103
0 commit comments