xml_find doens't see added attributes with namespaces
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Start by reproducing the behavior with the xml_add_child and xml_find_all calls shown in the issue, then inspect the relevant XML namespace handling for these entry points. Confirm that the XPath query finds the newly added namespaced attribute before serialization, while preserving the existing behavior for non-namespaced attributes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I'm trying to modify xml by adding child nodes with attributes, and then I'm looking for the subset of added nodes with attributes I just added:
library(xml2)
doc <- read_xml('<?xml version="1.0" encoding="UTF-8"?><bookstore xmlns:xxx="https://www.w3.org/"><book name="Harry Potter 1"></book></bookstore>')
node <- xml_find_first(doc, "book")
xml_add_child(node, .value="link", "xxx:resource"="http://harry_potter.com")
# Now, will try to find the node just added:
xpath <- "//book/link[@xxx:resource=\"http://harry_potter.com\"]"
# results 1:
xml_find_all(doc, xpath)
# nothing found: {xml_nodeset (0)}
# that's wrong
# saving to temporary file and loading from it:
write_xml(doc, "temp.xml")
doc <- read_xml('temp.xml')
# using same query again, results 2:
xml_find_all(doc, xpath)
# the results are correct and link is found
The bug is related to namespaces. If the added child node and query doesn't have xxx: namespace, the output is correct, and results 1 contain the node that was added.
- 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
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của r-lib/xml2
-
Export libxml2_version()Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 67/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Optimize xml_path() and xml_find_all() for large node setsCó thể đã có người làm @astruebi đã nhận 182 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Bioconductor/BiocParallel#289 ·
-
automation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
waldronlab/BugSigDBcuration#2224 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
merliseclyde/BAS#118 ·