Implement `c.xml_nodeset`

Đang mở
#433 0 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
42/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
r
Lĩnh vực
api

Hướng nghiên cứu

Start with the c.xml_nodeset method requested in the issue and compare its result with the input expected by xml_find_all. Reproduce the supplied example, then add coverage for combining st and bt; done means c(st, bt) retains the xml_nodeset class and xml_find_all(c(st, bt), "name") returns both name nodes.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

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

Ngôn ngữ chính
R
Star
227
Fork
86
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của r-lib/xml2

Tất cả issue của r-lib/xml2

Issue tương tự

Thêm issue về R

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.