xml_find doens't see added attributes with namespaces
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- R
- Estrellas
- 227
- Forks
- 86
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de r-lib/xml2
-
Export libxml2_version()Abierto
Dificultad 1/5 1-3 horas Aptitud para principiantes 67/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
Optimize xml_path() and xml_find_all() for large node setsPosiblemente ocupada @astruebi la tomó hace 182 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
Todos los issues de r-lib/xml2
Issues similares
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Bioconductor/BiocParallel#289 ·
-
automation
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
waldronlab/BugSigDBcuration#2224 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
merliseclyde/BAS#118 ·