xml2/0000755000176200001440000000000013232116464011136 5ustar liggesusersxml2/inst/0000755000176200001440000000000013231640172012110 5ustar liggesusersxml2/inst/extdata/0000755000176200001440000000000013223425477013554 5ustar liggesusersxml2/inst/extdata/order-schema.xml0000644000176200001440000000461613024532225016643 0ustar liggesusers Purchase order schema for Example.com. Copyright 2000 Example.com. All rights reserved. Purchase order schema for Example.Microsoft.com. Copyright 2001 Example.Microsoft.com. All rights reserved. Application info. xml2/inst/extdata/cd_catalog.xml0000644000176200001440000001173012722045135016350 0ustar liggesusers Empire Burlesque Bob Dylan USA Columbia 10.90 1985 Hide your heart Bonnie Tylor UK CBS Records 9.90 1988 Greatest Hits Dolly Parton USA RCA 9.90 1982 Still got the blues Gary More UK Virgin redords 10.20 1990 Eros Eros Ramazzotti EU BMG 9.90 1997 One night only Bee Gees UK Polydor 10.90 1998 Sylvias Mother Dr.Hook UK CBS 8.10 1973 Maggie May Rod Stewart UK Pickwick 8.50 1990 Romanza Andrea Bocelli EU Polydor 10.80 1996 When a man loves a woman Percy Sledge USA Atlantic 8.70 1987 Black angel Savage Rose EU Mega 10.90 1995 1999 Grammy Nominees Many USA Grammy 10.20 1999 For the good times Kenny Rogers UK Mucik Master 8.70 1995 Big Willie style Will Smith USA Columbia 9.90 1997 Tupelo Honey Van Morrison UK Polydor 8.20 1971 Soulsville Jorn Hoel Norway WEA 7.90 1996 The very best of Cat Stevens UK Island 8.90 1990 Stop Sam Brown UK A and M 8.90 1988 Bridge of Spies T`Pau UK Siren 7.90 1987 Private Dancer Tina Turner UK Capitol 8.90 1983 Midt om natten Kim Larsen EU Medley 7.80 1983 Pavarotti Gala Concert Luciano Pavarotti UK DECCA 9.90 1991 The dock of the bay Otis Redding USA Atlantic 7.90 1987 Picture book Simply Red EU Elektra 7.20 1985 Red The Communards UK London 7.80 1987 Unchain my heart Joe Cocker USA EMI 8.20 1987 xml2/inst/extdata/r-project.html0000644000176200001440000001160112616426337016347 0ustar liggesusers R: The R Project for Statistical Computing

The R Project for Statistical Computing

Getting Started

R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS. To download R, please choose your preferred CRAN mirror.

If you have questions about R like how to download and install the software, or what the license terms are, please read our answers to frequently asked questions before you send an email.

News

  • R 3.2.0 (Full of Ingredients) prerelease versions will appear starting March 19. Final release is scheduled for 2015-04-16.

  • R version 3.1.3 (Smooth Sidewalk) has been released on 2015-03-09.

  • The R Journal Volume 6/2 is available.

  • R version 3.1.2 (Pumpkin Helmet) has been released on 2014-10-31.

  • useR! 2015, will take place at the University of Aalborg, Denmark, June 30 - July 3, 2015.

  • useR! 2014, took place at the University of California, Los Angeles, USA June 30 - July 3, 2014.

xml2/inst/extdata/order-doc.xml0000644000176200001440000000200013024532225016131 0ustar liggesusers Alice Smith 123 Maple Street Mill Valley CA 90952 Robert Smith 8 Oak Avenue Old Town PA 95819 Hurry, my lawn is going wild! Lawnmower 1 148.95 Confirm this is electric Baby Monitor 1 39.98 1999-05-21 xml2/inst/doc/0000755000176200001440000000000013231640172012655 5ustar liggesusersxml2/inst/doc/modification.html0000644000176200001440000007715013231640172016222 0ustar liggesusers Node Modification

Node Modification

Jim Hester

2018-01-23

Modifying Existing XML

Modifying existing XML can be done in xml2 by using the replacement functions of the accessors. They all have methods for both individual xml_node objects as well as xml_nodeset objects. If a vector of values is provided it is applied piecewise over the nodeset, otherwise the value is recycled.

Text Modification

Text modification only happens on text nodes. If a given node has more than one text node only the first will be affected. If you want to modify additional text nodes you need to select them explicitly with /text().

Attribute and Namespace Definition Modification

Attributes and namespace definitions are modified one at a time with xml_attr() or all at once with xml_attrs(). In both cases using NULL as the value will remove the attribute completely.

Name Modification

Node names are modified with xml_name().

Node modification

All of these functions have a .copy argument. If this is set to FALSE they will remove the new node from its location before inserting it into the new location. Otherwise they make a copy of the node before insertion.

Replacing existing nodes

Add a sibling

Add a child

Removing nodes

The xml_remove() can be used to remove a node (and it’s children) from a tree. The default behavior is to unlink the node from the tree, but does not free the memory for the node, so R objects pointing to the node are still valid.

This allows code like the following to work without crashing R

If you are not planning on referencing these nodes again this memory is wasted. Calling xml_remove(free = TRUE) will remove the nodes and free the memory used to store them. Note In this case any node which previously pointed to the node or it’s children will instead be pointing to free memory and may cause R to crash. xml2 can’t figure this out for you, so it’s your responsibility to remove any objects which are no longer valid.

In particular xml_find_*() results are easy to overlook, for example

Namespaces

We want to construct a document with the following namespace layout. (From http://stackoverflow.com/questions/32939229/creating-xml-in-r-with-namespaces/32941524#32941524).

xml2/inst/doc/modification.R0000644000176200001440000000571613231640172015456 0ustar liggesusers## ---- echo = FALSE, message = FALSE-------------------------------------- knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(xml2) library(magrittr) ## ------------------------------------------------------------------------ x <- read_xml("

This is some text. This is more.

") xml_text(x) xml_text(x) <- "This is some other text." xml_text(x) # You can avoid this by explicitly selecting the text node. x <- read_xml("

This is some text. This is bold!

") text_only <- xml_find_all(x, "//text()") xml_text(text_only) <- c("This is some other text. ", "Still bold!") xml_text(x) xml_structure(x) ## ------------------------------------------------------------------------ x <- read_xml("xml2") xml_attr(x, "href") xml_attr(x, "href") <- "https://github.com/r-lib/xml2" xml_attr(x, "href") xml_attrs(x) <- c(id = "xml2", href = "https://github.com/r-lib/xml2") xml_attrs(x) x xml_attrs(x) <- NULL x # Namespaces are added with as a xmlns or xmlns:prefix attribute xml_attr(x, "xmlns") <- "http://foo" x xml_attr(x, "xmlns:bar") <- "http://bar" x ## ------------------------------------------------------------------------ x <- read_xml("") x xml_name(x) xml_name(x) <- "c" x ## ------------------------------------------------------------------------ x <- read_xml("123") children <- xml_children(x) t1 <- children[[1]] t2 <- children[[2]] t3 <- xml_children(children[[2]])[[1]] xml_replace(t1, t3) x ## ------------------------------------------------------------------------ x <- read_xml("123") children <- xml_children(x) t1 <- children[[1]] t2 <- children[[2]] t3 <- xml_children(children[[2]])[[1]] xml_add_sibling(t1, t3) x xml_add_sibling(t3, t1, where = "before") x ## ------------------------------------------------------------------------ x <- read_xml("123") children <- xml_children(x) t1 <- children[[1]] t2 <- children[[2]] t3 <- xml_children(children[[2]])[[1]] xml_add_child(t1, t3) x xml_add_child(t1, read_xml("")) x ## ------------------------------------------------------------------------ x <- read_xml("") x1 <- x %>% xml_children() %>% .[[1]] x2 <- x1 %>% xml_children() %>% .[[1]] xml_remove(x1) rm(x1) gc() x2 ## ------------------------------------------------------------------------ x <- read_xml("") bees <- xml_find_all(x, "//b") xml_remove(xml_child(x), free = TRUE) # bees[[1]] is no longer valid!!! rm(bees) gc() ## ------------------------------------------------------------------------ d <- xml_new_root("sld", xmlns = "http://www.o.net/sld", "xmlns:ogc" = "http://www.o.net/ogc", "xmlns:se" = "http://www.o.net/se", version = "1.1.0") %>% xml_add_child("layer") %>% xml_add_child("se:Name", "My Layer") %>% xml_root() d xml2/inst/doc/modification.Rmd0000644000176200001440000001176013223452366016002 0ustar liggesusers--- title: "Node Modification" author: "Jim Hester" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Node Modification} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, echo = FALSE, message = FALSE} knitr::opts_chunk$set(collapse = TRUE, comment = "#>") library(xml2) library(magrittr) ``` # Modifying Existing XML Modifying existing XML can be done in xml2 by using the replacement functions of the accessors. They all have methods for both individual `xml_node` objects as well as `xml_nodeset` objects. If a vector of values is provided it is applied piecewise over the nodeset, otherwise the value is recycled. ## Text Modification ## Text modification only happens on text nodes. If a given node has more than one text node only the first will be affected. If you want to modify additional text nodes you need to select them explicitly with `/text()`. ```{r} x <- read_xml("

This is some text. This is more.

") xml_text(x) xml_text(x) <- "This is some other text." xml_text(x) # You can avoid this by explicitly selecting the text node. x <- read_xml("

This is some text. This is bold!

") text_only <- xml_find_all(x, "//text()") xml_text(text_only) <- c("This is some other text. ", "Still bold!") xml_text(x) xml_structure(x) ``` ## Attribute and Namespace Definition Modification ## Attributes and namespace definitions are modified one at a time with `xml_attr()` or all at once with `xml_attrs()`. In both cases using `NULL` as the value will remove the attribute completely. ```{r} x <- read_xml("xml2") xml_attr(x, "href") xml_attr(x, "href") <- "https://github.com/r-lib/xml2" xml_attr(x, "href") xml_attrs(x) <- c(id = "xml2", href = "https://github.com/r-lib/xml2") xml_attrs(x) x xml_attrs(x) <- NULL x # Namespaces are added with as a xmlns or xmlns:prefix attribute xml_attr(x, "xmlns") <- "http://foo" x xml_attr(x, "xmlns:bar") <- "http://bar" x ``` ## Name Modification ## Node names are modified with `xml_name()`. ```{r} x <- read_xml("") x xml_name(x) xml_name(x) <- "c" x ``` # Node modification # All of these functions have a `.copy` argument. If this is set to `FALSE` they will remove the new node from its location before inserting it into the new location. Otherwise they make a copy of the node before insertion. ## Replacing existing nodes ## ```{r} x <- read_xml("123") children <- xml_children(x) t1 <- children[[1]] t2 <- children[[2]] t3 <- xml_children(children[[2]])[[1]] xml_replace(t1, t3) x ``` ## Add a sibling ## ```{r} x <- read_xml("123") children <- xml_children(x) t1 <- children[[1]] t2 <- children[[2]] t3 <- xml_children(children[[2]])[[1]] xml_add_sibling(t1, t3) x xml_add_sibling(t3, t1, where = "before") x ``` ## Add a child ## ```{r} x <- read_xml("123") children <- xml_children(x) t1 <- children[[1]] t2 <- children[[2]] t3 <- xml_children(children[[2]])[[1]] xml_add_child(t1, t3) x xml_add_child(t1, read_xml("")) x ``` ## Removing nodes ## The `xml_remove()` can be used to remove a node (and it's children) from a tree. The default behavior is to unlink the node from the tree, but does _not_ free the memory for the node, so R objects pointing to the node are still valid. This allows code like the following to work without crashing R ```{r} x <- read_xml("") x1 <- x %>% xml_children() %>% .[[1]] x2 <- x1 %>% xml_children() %>% .[[1]] xml_remove(x1) rm(x1) gc() x2 ``` If you are not planning on referencing these nodes again this memory is wasted. Calling `xml_remove(free = TRUE)` will remove the nodes _and_ free the memory used to store them. **Note** In this case _any_ node which previously pointed to the node or it's children will instead be pointing to free memory and may cause R to crash. xml2 can't figure this out for you, so it's your responsibility to remove any objects which are no longer valid. In particular `xml_find_*()` results are easy to overlook, for example ```{r} x <- read_xml("") bees <- xml_find_all(x, "//b") xml_remove(xml_child(x), free = TRUE) # bees[[1]] is no longer valid!!! rm(bees) gc() ``` ## Namespaces ## We want to construct a document with the following namespace layout. (From http://stackoverflow.com/questions/32939229/creating-xml-in-r-with-namespaces/32941524#32941524). ```xml My Layer ``` ```{r} d <- xml_new_root("sld", xmlns = "http://www.o.net/sld", "xmlns:ogc" = "http://www.o.net/ogc", "xmlns:se" = "http://www.o.net/se", version = "1.1.0") %>% xml_add_child("layer") %>% xml_add_child("se:Name", "My Layer") %>% xml_root() d ``` xml2/inst/include/0000755000176200001440000000000013024532225013532 5ustar liggesusersxml2/inst/include/xml2_types.h0000644000176200001440000000066513024532225016020 0ustar liggesusers#ifndef __XML2_XML2_TYPES__ #define __XML2_XML2_TYPES__ #include #include inline void finaliseNode(xmlNodePtr node) { // do nothing } inline void finaliseNs(xmlNsPtr ns) { // do nothing } typedef Rcpp::XPtr XPtrDoc; typedef Rcpp::XPtr XPtrNode; typedef Rcpp::XPtr XPtrNs; #endif xml2/tests/0000755000176200001440000000000013223520401012266 5ustar liggesusersxml2/tests/testthat.R0000644000176200001440000000006412710744614014267 0ustar liggesuserslibrary(testthat) library(xml2) test_check("xml2") xml2/tests/testthat/0000755000176200001440000000000013232116464014140 5ustar liggesusersxml2/tests/testthat/helper-version.R0000644000176200001440000000007712616426337017241 0ustar liggesuserscat("This is libxml2 version", xml2:::libxml2_version(), "\n") xml2/tests/testthat/test-url.R0000644000176200001440000000424112723346740016051 0ustar liggesuserscontext("url") test_that("url_absolute", { expect_equal( url_absolute(c(".", "..", "/", "/x"), "http://hadley.nz/a/b/c/d"), c("http://hadley.nz/a/b/c/", "http://hadley.nz/a/b/", "http://hadley.nz/", "http://hadley.nz/x")) expect_error(url_absolute(c(".", "..", "/", "/x"), c("http://hadley.nz/a/b/c/d", "http://foo.bar")), "Base URL must be length 1") }) test_that("url_relative", { expect_equal( url_relative("http://hadley.nz/a/c", "http://hadley.nz"), "/a/c") expect_equal( url_relative("http://hadley.nz/a/c", "http://hadley.nz/"), "../a/c") expect_equal( url_relative("http://hadley.nz/a/c", "http://hadley.nz/a/b"), "c") expect_equal( url_relative("http://hadley.nz/a/c", "http://hadley.nz/a/b/"), "../c") expect_error(url_relative("http://hadley.nz/a/c", c("http://hadley.nz/a/b/c/d", "http://foo.bar")), "Base URL must be length 1") }) test_that("url_parse", { expect_equal( url_parse("http://had.co.nz/"), data.frame(scheme = "http", server = "had.co.nz", port = NA_integer_, user = "", path = "/", query = "", fragment = "", stringsAsFactors = FALSE)) expect_equal( url_parse("http://had.co.nz:1234/"), data.frame(scheme = "http", server = "had.co.nz", port = 1234L, user = "", path = "/", query = "", fragment = "", stringsAsFactors = FALSE)) expect_equal( url_parse("http://had.co.nz:1234/?a=1&b=2"), data.frame(scheme = "http", server = "had.co.nz", port = 1234L, user = "", path = "/", query = "a=1&b=2", fragment = "", stringsAsFactors = FALSE)) expect_equal( url_parse("http://had.co.nz:1234/?a=1&b=2#def"), data.frame(scheme = "http", server = "had.co.nz", port = 1234L, user = "", path = "/", query = "a=1&b=2", fragment = "def", stringsAsFactors = FALSE)) }) test_that("url_escape", { expect_error(url_escape("a b c", reserved = c("a", "b")), "`reserved` must be character vector of length 1") expect_equal( url_escape("a b c"), "a%20b%20c") expect_equal( url_escape("a b c", " "), "a b c") expect_equal( url_unescape("a%20b%2fc"), "a b/c") expect_equal( url_unescape("%C2%B5"), "\u00B5") }) xml2/tests/testthat/test-xml_serialize.R0000644000176200001440000000236413223450334020111 0ustar liggesuserscontext("xml_serialize") x <- read_xml(" 123 456 ") test_that("xml_serialize and xml_unserialize work with xml_document input", { out <- xml_unserialize(xml_serialize(x, NULL)) expect_identical(as.character(x), as.character(out)) f <- tempfile() on.exit(unlink(f)) xml_serialize(x, f) expect_identical(as.character(xml_unserialize(f)), as.character(x)) }) test_that("xml_serialize and xml_unserialize work with xml_node input", { b <- xml_find_first(x, "//b") out <- xml_unserialize(xml_serialize(b, NULL)) expect_identical(as.character(b), as.character(out)) f <- tempfile() on.exit(unlink(f)) xml_serialize(b, f) expect_identical(as.character(xml_unserialize(f)), as.character(b)) }) test_that("xml_serialize and xml_unserialize work with xml_nodeset input", { b <- xml_find_all(x, "//b") out <- xml_unserialize(xml_serialize(b, NULL)) expect_identical(as.character(b), as.character(out)) f <- tempfile() on.exit(unlink(f)) xml_serialize(b, f) expect_identical(as.character(xml_unserialize(f)), as.character(b)) }) test_that("xml_unserialize throws an error if given a invalid object", { expect_error(xml_unserialize(serialize(1, NULL)), "Not a serialized xml2 object") }) xml2/tests/testthat/lego.html.bz20000644000176200001440000012323112616426337016462 0ustar liggesusersBZh91AY&SY~7u@@`ymۚ[cEFϽk继hyn rttu [lO(}z:}MʋX^ Z;}7޾޶kΩwoSn.i@zaxnŌjX;mͽwۺ>}j:wvvî*VGUsIK޾u_M 6ק|W};n;u5mlzݵwcr{o9rz۽}<G]SRo]er-{ݺgvͽwzz羺.Vu={ͻU}w{7n=k>9Wݻ۝^ޕNon9mgt=7Qk[\,/M;ת{}4ոy}fq^:gZ};}i=d}/v d@e4G4@&@& 44hBi6Q@ 40<'4c"M#4i&j4hd&B & 4hjzI=OI鉩 @$Dm&M5=SɣFM4ST&hDM hi !%=O)=M445x EQ j?*X#/H ( ̇`B;Jp? K1O8MĀ d*~@*a5Xq55m6eo& l(:ROSB&;0쭄tAME6L{٤5ڐ"X]N/PII}w[kQ 41Ь1(j9!O P7J0 24,:Bk.` Yzl2 D1r.(A=ЗlL}-Z˕MNDL j @(uk˱3SX1ZH1Ciƌl b@;Hw31k8ȲE+mffcid03ޗiQN 2 9_o_X"reE" ?ɻdb$(_X% WYj[DȕiX,•h@_ f>~J iJ + ͸1%0ԁqXjCȶTƚBy`"8S/@@ ֕"e0`((MM&BhNb$Hn12R IBF6*w@Mb^$đPTFRaqT/gH ~@2IdAQ5T" GBKlRB"0uaXUE @IdE"BsR@*Z{%A`!BESyƚ|&j1AUL;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z˞FBQP7";%wLzNp@QWz}!&o~ HT y?<}ӿ*u'gջ. Ђ=@"NK\%L^=?e|̅R)zxځʟWymJ>s]xB)܁N`j;ȆX )z N倫;9LT=TzRaJ v;N(G ։h4:;0Ґ_8Y8?=seP1(DR N hI|&}t5էɃL GYOggaD*@F@9^iP8J@"&R{[^$u1Zu'$%Foϋ}{*.tnP(!##̙0H  ȩ.vt::z5&_V?M8wY HXMZ,S>_每 nn`$}RdF"WYjv4`|GQ$<'Ar*{cd2 Qd|Qc*gD->OlK8 rf8of#ȉ&pBh(B@ۧ?D=,QVP,I뽆7/)lD"2~1 =T `)NBgMFFBB譄@_ ;hП|dIt{{~.t{Eե~|qRsG5PcpohjM菽r3Cuk9Yiy,F8>B[J `em# a> ݀8\E/9'[Gf[9H]-hR%i$[2Zb#X ӽ7~1 0S0`UBneXܘbWP3ABiulygwvz;m8p{ZB!|>hB[B .S;z,꛶lcd^w90$F#a/mN~{<rӆie1x.#'ƒ֢yu> B]-VdQiYH G*\xWc?_8RTr 1 vD)q1_cU~\R9W$$wa$.{g6א(⧺orꂔ c(y/ڊ/&7GM\ e  :0c eml> R. aS5Pp(fV lk6ƃ&9ghByg?g#[`:Э.넡\5`(/I=Oe9{?WcǍDYKbp<]vvjE&})ebqЕ a,z iqP"25335+XgysVeEܼ=|M(af؈CͽrE8P~7xml2/tests/testthat/test-xml_nodeset.R0000644000176200001440000000417213022625753017570 0ustar liggesuserscontext("xml_nodeset") test_that("methods work on empty nodesets", { x <- read_xml("") empty <- xml_find_all(x, "//c") expect_error(empty[[1]], "subscript out of bounds") expect_identical(empty[1], empty) test <- empty xml_attr(test, "test") <- 1 expect_identical(test, empty) xml_attrs(test) <- c("test" = 1) expect_identical(test, empty) xml_name(test) <- "test" expect_identical(test, empty) xml_text(test) <- "test" expect_identical(test, empty) expect_identical(as.character(empty), character(0)) expect_identical(as_list(empty), list()) expect_identical(nodeset_apply(empty, identical), empty) expect_output(print(empty), "\\{xml_nodeset \\(0\\)\\}") expect_output(tree_structure(empty), NA) xml_add_child(test, "test") expect_identical(test, empty) xml_add_sibling(test, "test") expect_identical(test, empty) expect_identical(xml_attr(empty, "test"), character()) expect_identical(xml_attrs(empty), list()) expect_identical(xml_double(empty), numeric()) expect_identical(xml_find_all(empty), empty) expect_identical(xml_find_chr(empty), character()) expect_identical(xml_find_first(empty), empty) expect_identical(xml_find_lgl(empty), logical()) expect_identical(xml_find_num(empty), numeric()) expect_identical(xml_integer(empty), integer()) expect_identical(xml_length(empty), 0L) expect_identical(xml_name(empty), character()) expect_identical(xml_ns(empty), character()) expect_identical(xml_parent(empty), empty) expect_identical(xml_path(empty), character()) xml_remove(test) expect_identical(test, empty) xml_replace(test) expect_identical(test, empty) xml_set_attr(test, "test", 1) expect_identical(test, empty) xml_set_attrs(test, c("test" = 1)) expect_identical(test, empty) xml_set_name(test, "test") expect_identical(test, empty) xml_set_text(test, "test") expect_identical(test, empty) expect_identical(xml_siblings(empty), empty) expect_output(xml_structure(empty), NA) expect_identical(xml_text(empty), character()) expect_identical(xml_type(empty), character()) expect_identical(xml_url(empty), character()) }) xml2/tests/testthat/test-read-xml.R0000644000176200001440000000342313223425616016755 0ustar liggesuserscontext("read_xml") test_that("read_html correctly parses malformed document", { lego <- read_html("lego.html.bz2") expect_equal(length(xml_find_all(lego, ".//p")), 39) }) test_that("parse_options errors when given an invalid option", { expect_error(parse_options("INVALID", xml_parse_options()), "`options` 'INVALID' is not a valid option") expect_error(read_html("lego.html.bz2", options = "INVALID"), "`options` 'INVALID' is not a valid option") # Empty inputs returned as 0 expect_identical(0L, parse_options("", xml_parse_options())) expect_identical(0L, parse_options(NULL, xml_parse_options())) # Numerics returned as integers expect_identical(12L, parse_options(12L, xml_parse_options())) expect_identical(12L, parse_options(12, xml_parse_options())) # Multiple inputs summed expect_identical(3L, parse_options(c("RECOVER", "NOENT"), xml_parse_options())) }) test_that("read_html properly passes parser arguments", { skip_if_not(libxml2_version() >= "2.9.2") blanks <- read_html(xml2_example("cd_catalog.xml"), options = c("RECOVER", "NOERROR")) expect_equal(as_list(blanks)$html$body$catalog$cd[[1]], "\r\n ") no_blanks <- read_html(xml2_example("cd_catalog.xml"), options = c("RECOVER", "NOERROR", "NOBLANKS")) expect_equal(as_list(no_blanks)$html$body$catalog$cd[[1]], list("Empire Burlesque")) }) test_that("read_xml works with httr response objects", { skip_on_cran() x <- read_xml(httr::GET("http://httpbin.org/xml")) expect_is(x, "xml_document") expect_equal(length(xml_find_all(x, "//slide")), 2) }) test_that("read_html works with httr response objects", { skip_on_cran() x <- read_html(httr::GET("http://httpbin.org/xml")) expect_is(x, "xml_document") expect_equal(length(xml_find_all(x, "//slide")), 2) }) xml2/tests/testthat/ns-multiple-aliases.xml0000644000176200001440000000016312723345322020553 0ustar liggesusers xml2/tests/testthat/test-xml_find.R0000644000176200001440000001075513223457167017060 0ustar liggesuserscontext("xml_find") # Find one --------------------------------------------------------------------- test_that("xml_find_first returns a missing object if no match", { x <- read_xml("") expect_equal(xml_find_first(x, ".//z"), xml_missing()) }) test_that("xml_find_first returns the first match if more than one match", { x <- read_xml("") y <- xml_find_first(x, ".//y") expect_is(y, "xml_node") }) test_that("xml_find_first does not deduplicate identical results", { x <- read_xml("") y <- xml_find_all(x, ".//y") z <- xml_find_first(y, "..") expect_is(z, "xml_nodeset") expect_equal(length(z), 2) }) # Find all --------------------------------------------------------------------- test_that("unqualified names don't look in default ns", { x <- read_xml("ns-multiple-default.xml") expect_equal(length(xml_find_all(x, "//bar")), 0) }) test_that("qualified names matches to namespace", { x <- read_xml("ns-multiple-default.xml") ns <- xml_ns(x) expect_equal(length(xml_find_all(x, "//d1:bar", ns)), 1) expect_equal(length(xml_find_all(x, "//d2:bar", ns)), 1) }) test_that("warning if unknown namespace", { x <- read_xml("") expect_warning(xml_find_all(x, "//g:bar"), "Undefined namespace prefix") }) test_that("no matches returns empty nodeset", { x <- read_xml("") expect_equal(length(xml_find_all(x, "//baz")), 0) }) # Find num --------------------------------------------------------------------- test_that("xml_find_num errors with non numeric results", { x <- read_xml("") expect_error(xml_find_num(x, "//z"), "result of type:.*xml_missing.*, not numeric") expect_error(xml_find_num(x, "//y"), "result of type:.*list.*, not numeric") expect_error(xml_find_num(x, "1=1"), "result of type:.*logical.*, not numeric") expect_error(xml_find_num(x, "string(5)"), "result of type:.*character.*, not numeric") }) test_that("xml_find_num returns a numeric result", { x <- read_xml("1") expect_equal(xml_find_num(x, "1 div 0"), Inf) expect_equal(xml_find_num(x, "-1 div 0"), -Inf) expect_equal(xml_find_num(x, "0 div 0"), NaN) expect_equal(xml_find_num(x, "1 div floor(-0.1)"), -1) expect_equal(xml_find_num(x, "1 div floor(0)"), Inf) expect_equal(xml_find_num(x, "1 div floor(-0)"), -Inf) }) # Find chr --------------------------------------------------------------------- test_that("xml_find_chr errors with non character results", { x <- read_xml("") expect_error(xml_find_chr(x, "//z"), "result of type:.*xml_missing.*, not character") expect_error(xml_find_chr(x, "//y"), "result of type:.*list.*, not character") expect_error(xml_find_chr(x, "1=1"), "result of type:.*logical.*, not character") expect_error(xml_find_chr(x, "1+1"), "result of type:.*numeric.*, not character") }) test_that("xml_find_chr returns a character result", { x <- read_xml("1") expect_equal(xml_find_chr(x, "string(5)"), "5") expect_equal(xml_find_chr(x, "string(0.5)"), "0.5") expect_equal(xml_find_chr(x, "string(-0.5)"), "-0.5") expect_equal(xml_find_chr(x, "concat(\"titi\", \"toto\")"), "tititoto") expect_equal(xml_find_chr(x, "substring(\"12345\", 2, 3)"), "234") expect_equal(xml_find_chr(x, "substring(\"12345\", 2)"), "2345") expect_equal(xml_find_chr(x, "substring(\"12345\", -4)"), "12345") }) # Find lgl --------------------------------------------------------------------- test_that("xml_find_lgl errors with non logical results", { x <- read_xml("") expect_error(xml_find_lgl(x, "//z"), "result of type:.*xml_missing.*, not logical") expect_error(xml_find_lgl(x, "//y"), "result of type:.*list.*, not logical") expect_error(xml_find_lgl(x, "string(5)"), "result of type:.*character.*, not logical") expect_error(xml_find_lgl(x, "1+1"), "result of type:.*numeric.*, not logical") }) test_that("xml_find_lgl returns a logical result", { x <- read_xml("1") expect_equal(xml_find_lgl(x, "1=1"), TRUE) expect_equal(xml_find_lgl(x, "1!=1"), FALSE) expect_equal(xml_find_lgl(x, "true()=true()"), TRUE) expect_equal(xml_find_lgl(x, "true()=false()"), FALSE) expect_equal(xml_find_lgl(x, "'test'='test'"), TRUE) }) test_that("Searches with empty inputs retain type stability", { empty <- xml_nodeset() expect_equal(xml_find_num(empty, "1 div 0"), integer()) expect_equal(xml_find_chr(empty, "string(0.5)"), character()) expect_equal(xml_find_lgl(empty, "1=1"), logical()) }) xml2/tests/testthat/test-xml_children.R0000644000176200001440000000301713223465443017715 0ustar liggesuserscontext("xml_children") x <- read_xml(" ") test_that("xml_child() returns the proper child", { expect_identical(xml_child(x), xml_children(x)[[1L]]) expect_identical(xml_child(x, 2), xml_children(x)[[2L]]) }) test_that("xml_child() returns child by name", { expect_identical(xml_child(x, "baz"), xml_find_first(x, "./baz")) }) test_that("xml_child() errors if more than one search is given", { expect_error(xml_child(x, 1:2), "`search` must be of length 1") }) test_that("xml_child() errors if search is not numeric or character", { expect_error(xml_child(x, TRUE), "`search` must be `numeric` or `character`") expect_error(xml_child(x, as.factor("test")), "`search` must be `numeric` or `character`") expect_error(xml_child(x, raw(1)), "`search` must be `numeric` or `character`") expect_error(xml_child(x, list(1)), "`search` must be `numeric` or `character`") }) test_that("xml_length", { expect_equal(xml_length(x), 2) all <- xml_find_all(x, "//*") expect_equal(xml_length(all), c(2, 1, 0, 0)) }) test_that("xml_parent", { expect_identical(unclass(xml_parent(xml_child(x))), unclass(x)) }) test_that("xml_parents", { expect_equal( xml_name(xml_parents(xml_find_first(x, "//boo"))), c("bar", "foo")) }) test_that("xml_root", { doc <- xml_new_document() expect_is(xml_root(doc), "xml_missing") a <- xml_add_child(doc, "a") b <- xml_add_child(doc, "b") expect_that(xml_name(xml_root(b)), equals("a")) expect_that(xml_name(xml_root(doc)), equals("a")) }) xml2/tests/testthat/test-write_xml.R0000644000176200001440000000717213031530260017250 0ustar liggesuserscontext("write_xml") test_that("write_xml errors for incorrect directory and with invalid inputs", { x <- read_xml("") filename <- ".../test.xml" expect_error(write_xml(x, filename), "'...' does not exist in current working directory") expect_error(write_xml(x, c("test.xml", "foo")), "`file` must be a non-zero character of length 1") }) test_that("write_xml works with relative file paths", { x <- read_xml("") filename <- "../test.xml" on.exit(unlink(filename)) write_xml(x, filename, options = "no_declaration") expect_identical(readChar(filename, 1000L), "\n") }) test_that("write_xml works with no options", { x <- read_xml("") filename <- "../test.xml" on.exit(unlink(filename)) write_xml(x, filename, options = NULL) expect_identical(readChar(filename, 1000L), "\n\n") }) test_that("write_xml works with an explicit connections", { x <- read_xml("") filename <- "../test.xml" file <- file(filename, "wb") on.exit(unlink(filename)) write_xml(x, file, options = "no_declaration") close(file) expect_identical(readChar(filename, 1000L), "\n") }) test_that("write_xml works with an implicit connections", { x <- read_xml("") filename <- "../test.xml.gz" write_xml(x, filename, options = "no_declaration") file <- gzfile(filename, "rb") on.exit({unlink(filename); close(file)}) expect_identical(readChar(file, 1000L), "\n") }) test_that("write_xml works with nodeset input and files", { x <- read_xml("") y <- xml_find_all(x, "//y") filename <- "../test.xml" on.exit(unlink(filename)) expect_error(write_xml(y, filename, options = "no_declaration"), "Can only save length 1 node sets") write_xml(y[1], filename, options = "no_declaration") expect_identical(readChar(filename, 1000L), "") }) test_that("write_xml works with nodeset input and connections", { x <- read_xml("") y <- xml_find_all(x, "//y") filename <- "../test.xml.gz" expect_error(write_xml(y, filename, options = "no_declaration"), "Can only save length 1 node sets") expect_error(write_xml(y[1], c(filename, "foo")), "`file` must be a non-zero character of length 1") write_xml(y[1], filename, options = "no_declaration") file <- gzfile(filename, "rb") on.exit({unlink(filename); close(file)}) expect_identical(readChar(file, 1000L), "") }) test_that("write_xml works with node input and files", { x <- read_xml("") y <- xml_find_first(x, "//y") filename <- "../test.xml" expect_error(write_xml(y, c(filename, "foo")), "`file` must be a non-zero character of length 1") write_xml(y, filename, options = "no_declaration") on.exit(unlink(filename)) expect_identical(readChar(filename, 1000L), "") }) test_that("write_xml works with node input and connections", { x <- read_xml("") y <- xml_find_first(x, "//y") filename <- "../test.xml.gz" write_xml(y, filename, options = "no_declaration") file <- gzfile(filename, "rb") on.exit({unlink(filename); close(file)}) expect_identical(readChar(file, 1000L), "") }) test_that("write_html work with html input", { x <- read_html("Foo") filename <- "../test.html.gz" write_html(x, filename) file <- gzfile(filename, "rb") on.exit({unlink(filename); close(file)}) expect_identical(readChar(file, 1000L), "\n\n\nFoo\n\n") }) xml2/tests/testthat/test-null.R0000644000176200001440000000506313022625753016221 0ustar liggesuserscontext("Null XPtr") data <- read_xml("ns-multiple.xml") tf <- tempfile() on.exit(unlink(tf)) saveRDS(data, file = tf) x <- readRDS(tf) test_that("accessors all fail rather than crash with NULL Xptrs", { expect_error(as_list(x), "external pointer is not valid") expect_error(html_structure(x), "external pointer is not valid") expect_error(xml_add_child(x, x), "external pointer is not valid") expect_error(xml_add_sibling(x, x), "external pointer is not valid") expect_error(xml_attr(x, "foo"), "external pointer is not valid") expect_error(xml_attr(x, "foo") <- "bar", "external pointer is not valid") expect_error(xml_attrs(x), "external pointer is not valid") expect_error(xml_attrs(x) <- list(), "external pointer is not valid") expect_error(xml_child(x), "external pointer is not valid") expect_error(xml_children(x), "external pointer is not valid") expect_error(xml_contents(x), "external pointer is not valid") expect_error(xml_double(x), "external pointer is not valid") expect_error(xml_find_all(x, ""), "external pointer is not valid") expect_error(xml_find_chr(x, ""), "external pointer is not valid") expect_error(xml_find_first(x, ""), "external pointer is not valid") expect_error(xml_find_lgl(x, ""), "external pointer is not valid") expect_error(xml_find_num(x, ""), "external pointer is not valid") expect_error(xml_has_attr(x, ""), "external pointer is not valid") expect_error(xml_integer(x), "external pointer is not valid") expect_error(xml_length(x), "external pointer is not valid") expect_error(xml_name(x), "external pointer is not valid") expect_error(xml_name(x) <- "foo", "external pointer is not valid") expect_error(xml_ns(x), "external pointer is not valid") expect_error(xml_ns_strip(x), "external pointer is not valid") expect_error(xml_parent(x), "external pointer is not valid") expect_error(xml_parents(x), "external pointer is not valid") expect_error(xml_path(x), "external pointer is not valid") expect_error(xml_remove(x), "external pointer is not valid") expect_error(xml_replace(x, x), "external pointer is not valid") expect_error(xml_set_namespace(x, "foo"), "external pointer is not valid") expect_error(xml_siblings(x), "external pointer is not valid") expect_error(xml_structure(x), "external pointer is not valid") expect_error(xml_text(x), "external pointer is not valid") expect_error(xml_text(x) <- "test", "external pointer is not valid") expect_error(xml_type(x), "external pointer is not valid") expect_error(xml_url(x), "external pointer is not valid") }) xml2/tests/testthat/test-xml_text.R0000644000176200001440000000407513024544315017111 0ustar liggesuserscontext("xml_text") test_that("xml_text returns only text without markup", { x <- read_xml("

This is some text. This is bold!

") expect_identical(xml_text(x), "This is some text. This is bold!") expect_identical(xml_text(xml_children(x)), "bold!") }) test_that("xml_text returns only text without markup", { x <- read_xml("

This is some text. This is bold!

") expect_identical(xml_text(x), "This is some text. This is bold!") expect_identical(xml_text(xml_children(x)), "bold!") }) test_that("xml_text works properly with xml_nodeset objects", { x <- read_xml("This is some text. This is some nested text.") expect_identical(xml_text(x), "This is some text. This is some nested text.") expect_identical(xml_text(xml_find_all(x, "//x")), c("This is some text. This is some nested text.", "This is some nested text.")) }) test_that("xml_text<- and xml_set_text work properly with xml_nodeset objects", { x <- read_xml("This is some text. This is some nested text.") expect_identical(xml_text(x), "This is some text. This is some nested text.") xml_text(x) <- "test" expect_identical(xml_text(x), "testThis is some nested text.") xml_set_text(x, "test2") expect_identical(xml_text(x), "test2This is some nested text.") }) test_that("xml_text trims whitespace if requested, including non-breaking spaces", { x <- read_html("

Some text €  

") expect_identical(xml_text(x), " Some text \u20ac \u00a0") expect_identical(xml_text(x, trim = TRUE), "Some text \u20ac") }) test_that("xml_integer() returns an integer vector", { x <- read_xml("") expect_identical(xml_integer(xml_find_all(x, "//@x")), c(1L, 2L)) }) test_that("xml_double() returns a numeric vector", { x <- read_xml("") expect_identical(xml_double(xml_find_all(x, "//@latitude")), c(42.3466456, -36.8523378)) }) xml2/tests/testthat/test-xml_attrs.R0000644000176200001440000001553113223437402017260 0ustar liggesuserscontext("xml_attrs") test_that("missing attributes returned as NA by default", { x <- read_xml("") expect_equal(xml_attr(x, "id"), NA_character_) }) test_that("missing attributes returned as NA", { x <- read_xml("") expect_equal(xml_attr(x, "id", default = 1), "1") }) test_that("attributes are correctly found", { x <- read_xml("") expect_true(xml_has_attr(x, "id")) expect_false(xml_has_attr(x, "id2")) }) test_that("returning an attribute node prints properly", { x <- read_xml("") t1 <- xml_find_first(x, "//@c") expect_equal(format(t1), "") }) # Namespaces ------------------------------------------------------------------- # Default namespace doesn't apply to attributes test_that("qualified names returned when ns given", { x <- read_xml("ns-multiple.xml") ns <- xml_ns(x) bars <- xml_children(xml_children(x)) attr <- xml_attrs(bars, ns) expect_equal(names(attr[[1]]), "f:id") expect_equal(names(attr[[2]]), "g:id") }) x <- read_xml(' ') doc <- xml_children(x)[[1]] docs <- xml_find_all(x, "//doc") ns <- xml_ns(x) test_that("qualified attributes get own values", { expect_equal(xml_attrs(doc, ns), c("b:id" = "b", "f:id" = "f", "id" = "")) }) test_that("unqualified name gets unnamespace attribute", { expect_equal(xml_attr(doc, "id", ns), "") }) test_that("namespace names gets namespaced attribute", { expect_equal(xml_attr(doc, "b:id", ns), "b") expect_equal(xml_attr(doc, "f:id", ns), "f") }) test_that("xml_attr<- modifies properties", { xml_attr(doc, "id", ns) <- "test" expect_equal(xml_attr(doc, "id", ns), "test") xml_attr(doc, "b:id", ns) <- "b_test" expect_equal(xml_attr(doc, "b:id", ns), "b_test") xml_attr(doc, "f:id", ns) <- "f_test" expect_equal(xml_attr(doc, "f:id", ns), "f_test") xml_attr(docs, "f:id", ns) <- "f_test2" expect_equal(xml_attr(docs, "f:id", ns), c("f_test2", "f_test2")) xml_attr(docs, "f:id", ns) <- NULL expect_equal(xml_attr(docs, "f:id", ns), c(NA_character_, NA_character_)) }) test_that("xml_attrs<- modifies all attributes", { expect_error(xml_attrs(doc) <- 1, "`value` must be a named character vector or `NULL`") expect_error(xml_attrs(doc) <- "test", "`value` must be a named character vector or `NULL`") xml_attrs(doc, ns) <- c("b:id" = "b", "f:id" = "f", "id" = "test") expect_equal(xml_attrs(doc, ns), c("b:id" = "b", "id" = "test", "f:id" = "f")) xml_attrs(doc, ns) <- c("b:id" = "b", "f:id" = "f") expect_equal(xml_attrs(doc, ns), c("b:id" = "b", "f:id" = "f")) xml_attrs(doc, ns) <- c("b:id" = "b", "id" = "test") expect_equal(xml_attrs(doc, ns), c("b:id" = "b", "id" = "test")) expect_error(xml_attrs(docs) <- "test", "`value` must be a list of named character vectors") xml_attrs(docs, ns) <- c("b:id" = "b", "id" = "test") expect_equal(xml_attrs(docs, ns), list( c("b:id" = "b", "id" = "test"), c("b:id" = "b", "id" = "test"))) xml_attrs(docs, ns) <- NULL expect_equivalent(xml_attrs(docs, ns), list(character(0), character(0))) }) test_that("xml_attr<- accepts non-character values", { x <- read_xml('') svg <- xml_root(x) xml_attr(svg, "width") <- 8L expect_that(xml_attr(svg, "width"), equals("8")) xml_attr(svg, "height") <- 12.5 expect_that(xml_attr(svg, "height"), equals("12.5")) expect_that(xml_attrs(svg), equals(c(width = "8", height = "12.5"))) xml_attrs(svg) <- c(width = 14L, height = 23.45) expect_that(xml_attrs(svg), equals(c(width = "14", height = "23.45"))) }) test_that("xml_attr<- can set empty strings, and removes attributes with NULL", { x <- read_xml("") xml_attr(x, "test") <- "" expect_equal(xml_attr(x, "test"), "") xml_attr(x, "test") <- NULL expect_equal(xml_attr(x, "test"), NA_character_) }) test_that("xml_attr<- removes namespaces if desired", { xml_attr(x, "xmlns:b") <- NULL expect_equal(xml_attrs(x), c("xmlns:f" = "http://foo.com")) }) test_that("xml_attr<- removes namespaces if desired", { x <- read_xml("") # cannot find //b with a default namespace expect_equal(length(xml_find_all(x, "//b")), 0) # unless we specify it explicitly expect_equal(length(xml_find_all(x, "//b")), 0) expect_equal(length(xml_find_all(x, "//d1:b", xml_ns(x))), 1) # but can find it once we remove the namespace xml_attr(x, "xmlns") <- NULL expect_equal(length(xml_find_all(x, "//b")), 1) # and add the old namespace back xml_attr(x, "xmlns") <- "tag:foo" expect_equal(xml_attr(x, "xmlns"), "tag:foo") expect_equal(length(xml_find_all(x, "//b")), 0) expect_equal(length(xml_find_all(x, "//d1:b", xml_ns(x))), 1) expect_equal(xml_attr(x, "xmlns"), "tag:foo") }) test_that("xml_attr<- removes prefixed namespaces if desired", { x <- read_xml("") # cannot find //b with a prefixed namespace expect_equal(length(xml_find_all(x, "//b")), 0) # unless we specify it explicitly expect_equal(length(xml_find_all(x, "//b")), 0) expect_equal(length(xml_find_all(x, "//pre:b", xml_ns(x))), 1) # but can find it once we remove the namespace xml_attr(x, "xmlns:pre") <- NULL expect_equal(length(xml_find_all(x, "//b")), 1) # and add the old namespace back xml_attr(x, "xmlns:pre") <- "tag:foo" xml_set_namespace(xml_children(x)[[1]], "pre") expect_equal(xml_attr(x, "xmlns:pre"), "tag:foo") expect_equal(length(xml_find_all(x, "//b")), 0) expect_equal(length(xml_find_all(x, "//pre:b", xml_ns(x))), 1) expect_equal(xml_attr(x, "xmlns:pre"), "tag:foo") }) test_that("xml_set_attr works identically to xml_attr<-", { content <- "" x <- read_xml(content) y <- read_xml(content) xml_attr(x, "a") <- "test" xml_set_attr(y, "a", "test") expect_equal(as.character(x), as.character(y)) bx <- xml_find_all(x, "//b") by <- xml_find_all(y, "//b") xml_attr(bx, "b") <- "test2" xml_set_attr(by, "b", "test2") expect_equal(as.character(x), as.character(y)) # No errors for xml_missing mss <- xml_find_first(bx, "./c") expect_error(xml_attr(mss[[2]], "b") <- "blah", NA) expect_error(xml_set_attr(mss[[2]], "b", "blah"), NA) }) test_that("xml_set_attrs works identically to xml_attrs<-", { content <- "" x <- read_xml(content) y <- read_xml(content) xml_attrs(x) <- c(a = "test") xml_set_attrs(y, c(a = "test")) expect_equal(as.character(x), as.character(y)) bx <- xml_find_all(x, "//b") by <- xml_find_all(y, "//b") xml_attrs(bx) <- c(b = "test2") xml_set_attrs(by, c(b = "test2")) expect_equal(as.character(x), as.character(y)) # No errors for xml_missing mss <- xml_find_first(bx, "./c") expect_error(xml_attrs(mss[[2]]) <- c("b" = "blah"), NA) expect_error(xml_set_attrs(mss[[2]], c("b" = "blah")), NA) }) xml2/tests/testthat/test-comment.R0000644000176200001440000000040213033457452016702 0ustar liggesuserscontext("comment") test_that("Comment creation works", { x <- xml_new_root("root") xml_add_child(x, xml_comment("Hello!")) expect_identical("\n\n", as.character(x, options = "")) }) xml2/tests/testthat/output/0000755000176200001440000000000013033275002015471 5ustar liggesusersxml2/tests/testthat/output/print-xml_nodeset.txt0000644000176200001440000000137113033457602021717 0ustar liggesusers{xml_nodeset (10)} [1]
\n
\n\n