Browse Source
forgot CRAN & Travis can't do headless browsing for widget testing
master
Bob Rudis
7 years ago
No known key found for this signature in database
GPG Key ID: 1D7529BE14E2BBA9
6 changed files with
39 additions and
26 deletions
-
R/xmltreeview.R
-
R/xmlview.R
-
inst/examples/examples-xml_tree_view.R
-
inst/examples/rss-example.R
-
man/xml_tree_view.Rd
-
man/xml_view.Rd
|
|
@ -19,7 +19,21 @@ |
|
|
|
#' or used in a browser context vs an IDE viewer context. |
|
|
|
#' @export |
|
|
|
#' @references \href{https://github.com/juliangruber/xml-viewer}{xml-viewer} |
|
|
|
#' @example inst/examples/examples-xml_tree_view.R |
|
|
|
#' @examples \dontrun{ |
|
|
|
#' library(htmltidy) |
|
|
|
#' |
|
|
|
#' # from ?xml2::read_xml |
|
|
|
#' cd <- xml2::read_xml("http://www.xmlfiles.com/examples/cd_catalog.xml") |
|
|
|
#' |
|
|
|
#' xml_tree_view(cd) |
|
|
|
#' |
|
|
|
#' htmltools::browsable( |
|
|
|
#' htmltools::tagList( |
|
|
|
#' xml_tree_view(cd, width = "100%", height = "300px"), |
|
|
|
#' xml_view(cd) |
|
|
|
#' ) |
|
|
|
#' ) |
|
|
|
#' } |
|
|
|
xml_tree_view <- function(doc=NULL, scroll=FALSE, |
|
|
|
elementId=NULL, width="100%", height=NULL) { |
|
|
|
|
|
|
|
|
|
@ -27,7 +27,7 @@ |
|
|
|
#' @export |
|
|
|
#' @references \href{https://highlightjs.org/}{highlight.js}, |
|
|
|
#' \href{http://www.eslinstructor.net/vkbeautify/}{vkbeautify} |
|
|
|
#' @examples |
|
|
|
#' @examples \dontrun{ |
|
|
|
#' library(xml2) |
|
|
|
#' |
|
|
|
#' # plain text |
|
|
@ -52,6 +52,16 @@ |
|
|
|
#' # filter + apply an initial XPath query string |
|
|
|
#' xml_view(read_xml(system.file("extdata/dwml.xml", package="xmlview")), |
|
|
|
#' add_filter=TRUE, apply_xpath=".//temperature") |
|
|
|
#' |
|
|
|
#' doc <- read_xml("http://www.npr.org/rss/rss.php?id=1001") |
|
|
|
#' |
|
|
|
#' str(doc) |
|
|
|
#' |
|
|
|
#' xml_view(doc, add_filter=TRUE) |
|
|
|
#' xml2::xml_find_all(doc, './/dc:creator', ns=xml2::xml_ns(doc)) |
|
|
|
#' |
|
|
|
#' xml_text(xml2::xml_find_all(doc, './/link[contains(., "soccer")]', ns=xml2::xml_ns(doc))) |
|
|
|
#' } |
|
|
|
xml_view <- function(doc, style="default", scroll=FALSE, add_filter=FALSE, |
|
|
|
apply_xpath=NULL, elementId=NULL, |
|
|
|
width="100%", height=NULL) { |
|
|
|
|
|
@ -1,13 +0,0 @@ |
|
|
|
library(htmltidy) |
|
|
|
|
|
|
|
# from ?xml2::read_xml |
|
|
|
cd <- xml2::read_xml("http://www.xmlfiles.com/examples/cd_catalog.xml") |
|
|
|
|
|
|
|
xml_tree_view(cd) |
|
|
|
|
|
|
|
htmltools::browsable( |
|
|
|
htmltools::tagList( |
|
|
|
xml_tree_view(cd, width = "100%", height = "300px"), |
|
|
|
xml_view(cd) |
|
|
|
) |
|
|
|
) |
|
|
@ -1,11 +0,0 @@ |
|
|
|
library(xml2) |
|
|
|
|
|
|
|
doc <- read_xml("http://www.npr.org/rss/rss.php?id=1001") |
|
|
|
|
|
|
|
str(doc) |
|
|
|
|
|
|
|
xml_view(doc, add_filter=TRUE) |
|
|
|
xml2::xml_find_all(doc, './/dc:creator', ns=xml2::xml_ns(doc)) |
|
|
|
|
|
|
|
xml_text(xml2::xml_find_all(doc, './/link[contains(., "soccer")]', ns=xml2::xml_ns(doc))) |
|
|
|
|
|
|
@ -38,6 +38,7 @@ Large HTML or XML content may take some time to render properly. It is suggested |
|
|
|
or used in a browser context vs an IDE viewer context. |
|
|
|
} |
|
|
|
\examples{ |
|
|
|
\dontrun{ |
|
|
|
library(htmltidy) |
|
|
|
|
|
|
|
# from ?xml2::read_xml |
|
|
@ -52,6 +53,7 @@ htmltools::browsable( |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
\references{ |
|
|
|
\href{https://github.com/juliangruber/xml-viewer}{xml-viewer} |
|
|
|
} |
|
|
|
|
|
@ -48,6 +48,7 @@ Large HTML or XML content may take some time to render properly. It is suggested |
|
|
|
or used in a browser context vs an IDE viewer context. |
|
|
|
} |
|
|
|
\examples{ |
|
|
|
\dontrun{ |
|
|
|
library(xml2) |
|
|
|
|
|
|
|
# plain text |
|
|
@ -72,6 +73,16 @@ xml_view(read_xml(system.file("extdata/input.xml", package="htmltidy")), |
|
|
|
# filter + apply an initial XPath query string |
|
|
|
xml_view(read_xml(system.file("extdata/dwml.xml", package="xmlview")), |
|
|
|
add_filter=TRUE, apply_xpath=".//temperature") |
|
|
|
|
|
|
|
doc <- read_xml("http://www.npr.org/rss/rss.php?id=1001") |
|
|
|
|
|
|
|
str(doc) |
|
|
|
|
|
|
|
xml_view(doc, add_filter=TRUE) |
|
|
|
xml2::xml_find_all(doc, './/dc:creator', ns=xml2::xml_ns(doc)) |
|
|
|
|
|
|
|
xml_text(xml2::xml_find_all(doc, './/link[contains(., "soccer")]', ns=xml2::xml_ns(doc))) |
|
|
|
} |
|
|
|
} |
|
|
|
\references{ |
|
|
|
\href{https://highlightjs.org/}{highlight.js}, |
|
|
|