xml_find doens't see added attributes with namespaces
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- R
- スター
- 227
- フォーク
- 86
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
r-lib/xml2 のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 67/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
Optimize xml_path() and xml_find_all() for large node sets対応中かも @astruebi が 182 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
似ている issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
Bioconductor/BiocParallel#289 ·
-
automation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
waldronlab/BugSigDBcuration#2224 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
merliseclyde/BAS#118 ·