Implement `c.xml_nodeset`

Abierto
#433 0 comentarios 2 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
42/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
r
Área
api

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
R
Estrellas
227
Forks
86
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de r-lib/xml2

Todos los issues de r-lib/xml2

Issues similares

Más issues de R

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.