Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement c.xml_nodeset #433

Open
AshesITR opened this issue Dec 13, 2023 · 0 comments
Open

Implement c.xml_nodeset #433

AshesITR opened this issue Dec 13, 2023 · 0 comments

Comments

@AshesITR
Copy link

Since c.xml_nodeset ist not defined, combining nodesets drops the class and breaks the following usage if not manually applying the class:

library(xml2)
xml <- xml_ns_strip(read_xml(xml2_example("order-doc.xml")))
st <- xml_find_all(xml, "//shipTo")
bt <- xml_find_all(xml, "//billTo")
both <- c(st, bt)
class(both) <- "xml_nodeset"
xml_find_all(both, "name")
#> {xml_nodeset (2)}
#> [1] <name>Alice Smith</name>
#> [2] <name>Robert Smith</name>

xml_find_all(c(st, bt), "name")
#> Error in UseMethod("xml_find_all"): no applicable method for 'xml_find_all' applied to an object of class "list"

Created on 2023-12-13 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant