expression

Repeated XML elements

Represent contiguous repeated elements using a vector. This is a scoped simple record mapping, not a universal mixed-content XML representation. This example uses external crates; see the staged Cargo manifest. Expected stdout (not executed): Sun / Moon Common mistake: Assuming all sequences in arbitrary XML map identically regardless of nesting and order.

Formal Syntax & Structure

rust syntaxrust
Vec<T> with repeated child name

Working Example

Example Snippetrust
fn main() {    #[derive(serde::Deserialize)]    struct Shelf { book: Vec<String> }    let shelf: Shelf = quick_xml::de::from_str("<shelf><book>Sun</book><book>Moon</book></shelf>").unwrap();    println!("{}", shelf.book.join(" / "));}
Rust Reference