Skip to content

Support document-oriented XML? #45

@FranklinChen

Description

@FranklinChen

It seems this tool merges elements at the same level rather than preserve document order, e.g.

<doc>
    <comment>A comment.</comment>
    <sentence>This is the first sentence.</sentence>
    <break/>
    <sentence>This is the second sentence.</sentence>
    <sentence>This is the third sentence.</sentence>
    <comment>Another comment.</comment>
</doc>

results in something I don't expect, where instead of <doc> being treated as a list of possible sub-elements, it's doing a reorder and merge. Will a document-oriented order ever be supported?

use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
pub struct Doc {
    #[serde(rename = "$text")]
    pub text: Option<String>,
    #[serde(rename = "break")]
    pub doc_break: Break,
    pub sentence: Vec<String>,
    pub comment: Vec<String>,
}

#[derive(Serialize, Deserialize)]
pub struct Break {
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions