2424# ' # Note the each unique node only appears once in the output
2525# ' xml_parent(xml_children(x))
2626# '
27+ # ' # But you avoid this deduplication if needed
28+ # ' xml_parent(xml_children(x), deduplicate = FALSE)
29+ # '
2730# ' # Mixed content
2831# ' x <- read_xml("<foo> a <b/> c <d>e</d> f</foo>")
2932# ' # Childen gets the elements, contents gets all node types
3740# ' xml_child(x)
3841# ' xml_child(x, 2)
3942# ' xml_child(x, "baz")
40- xml_children <- function (x ) {
41- nodeset_apply(x , function (x ) .Call(node_children , x , TRUE ))
43+ xml_children <- function (x , ... ) {
44+ nodeset_apply(x , function (x ) .Call(node_children , x , TRUE ), ... )
4245}
4346
4447# ' @export
@@ -65,8 +68,8 @@ xml_contents <- function(x) {
6568
6669# ' @export
6770# ' @rdname xml_children
68- xml_parents <- function (x ) {
69- nodeset_apply(x , function (x ) .Call(node_parents , x ))
71+ xml_parents <- function (x , ... ) {
72+ nodeset_apply(x , function (x ) .Call(node_parents , x ), ... )
7073}
7174
7275# ' @export
@@ -77,23 +80,23 @@ xml_siblings <- function(x) {
7780
7881# ' @export
7982# ' @rdname xml_children
80- xml_parent <- function (x ) {
83+ xml_parent <- function (x , ... ) {
8184 UseMethod(" xml_parent" )
8285}
8386
8487# ' @export
85- xml_parent.xml_missing <- function (x ) {
88+ xml_parent.xml_missing <- function (x , ... ) {
8689 xml_missing()
8790}
8891
8992# ' @export
90- xml_parent.xml_node <- function (x ) {
93+ xml_parent.xml_node <- function (x , ... ) {
9194 xml_node(.Call(node_parent , x $ node ), x $ doc )
9295}
9396
9497# ' @export
95- xml_parent.xml_nodeset <- function (x ) {
96- nodeset_apply(x , function (x ) .Call(node_parent , x ))
98+ xml_parent.xml_nodeset <- function (x , ... ) {
99+ nodeset_apply(x , function (x ) .Call(node_parent , x ), ... )
97100}
98101
99102
0 commit comments