Skip to content

Implement c.xml_nodeset #433

Description

@AshesITR

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

Activity

  1. added
    bugan unexpected problem or unintended behavior
    on Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions