Understanding empty tag behavior

Abierto
#741 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
34/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
rust
Área
backend

Línea de trabajo

Start by reading the read_event() handling for empty XML elements and the Event::Text behavior used in the shown Rust match. Reproduce the reported value with the provided <value></value> example, then check the relevant parser tests. Done means the behavior is explained or corrected and covered by a test; the issue has had no comment for 844 days, so first check whether anyone is still responding.

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

Descripción

question

First of all, I want to thank everyone involved in this project for the excellent work they've done. It's absurdly fast and fits great in my project.

I have a question about expected behavior for empty tags. I have some XML that looks like this:

...
<value></value>
<value></value>
...
<value></value>
...

That is being parsed by this code:

match (state, reader.read_event()?) {
 (State::ResultsInnerValueInner, Event::Text(e)) => {
         column.push(e.unescape_with(irods_unescapes)?.to_string());
         State::ResultsInnerValue
   }
}

When I later print this value out, it has the value "\n". Is this expected behavior? I think I've seen it a couple other times. I would have guessed that the output would be the empty &str.

Lenguaje dominante
Rust
Estrellas
1.6k
Forks
299
Merge medio
2 d 4 h
PR fusionados (30 d)
9

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 tafia/quick-xml

Todos los issues de tafia/quick-xml

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.