From d52698f2382db9e3e169e7d0c32aaae0a2fa27a3 Mon Sep 17 00:00:00 2001
From: Jake Hughey
Date: Mon, 13 Jul 2020 20:52:58 -0500
Subject: [PATCH 1/3] added flatten argument to xml_find_all.xml_nodeset.
---
DESCRIPTION | 4 +--
NEWS.md | 2 ++
R/xml_find.R | 48 +++++++++++++++++++++++++---------
man/xml_find_all.Rd | 28 +++++++++++++++-----
tests/testthat/test-xml_find.R | 11 ++++++++
5 files changed, 72 insertions(+), 21 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index b44131b1..dcd3bb43 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: xml2
Title: Parse XML
-Version: 1.3.2.9000
+Version: 1.3.2.9001
Authors@R:
c(person(given = "Hadley",
family = "Wickham",
@@ -40,7 +40,7 @@ VignetteBuilder:
knitr
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
-RoxygenNote: 7.1.0
+RoxygenNote: 7.1.1
SystemRequirements: libxml2: libxml2-dev (deb), libxml2-devel
(rpm)
Collate:
diff --git a/NEWS.md b/NEWS.md
index 13cf97f4..bd953151 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,7 @@
# xml2 (development version)
+* `xml_find_all.xml_nodeset()` gains a `flatten` argument to control whether to return a single nodeset or a list of nodesets (#311)
+
* `write_xml()` and `write_html()` now return NULL invisibly, as they did prior to version 1.3.0 (#307)
# xml2 1.3.2
diff --git a/R/xml_find.R b/R/xml_find.R
index efbf17cb..b1b48f94 100644
--- a/R/xml_find.R
+++ b/R/xml_find.R
@@ -12,9 +12,11 @@
#' @param xpath A string containing a xpath (1.0) expression.
#' @inheritParams xml_name
-#' @return `xml_find_all` always returns a nodeset: if there are no matches
-#' the nodeset will be empty. The result will always be unique; repeated
-#' nodes are automatically de-duplicated.
+#' @param ... Further arguments passed to or from other methods.
+#' @return `xml_find_all` returns a nodeset if applied to a node, and a nodeset
+#' or a list of nodesets if applied to a nodeset. If there are no matches,
+#' the nodeset(s) will be empty. Within each nodeset, the result will always
+#' be unique; repeated nodes are automatically de-duplicated.
#'
#' `xml_find_first` returns a node if applied to a node, and a nodeset
#' if applied to a nodeset. The output is *always* the same size as
@@ -46,11 +48,16 @@
#'
Some text.
+ Some other text.
+ No bold here!