strong-xml
strong-xml copied to clipboard
Parsing #PCDATA is impossible
Hi, this crate is fantastic for parsing strictly-structured information, but in the XML documents that I'm using there are several tags which can contain mixed content (for rich-text renderers). For example, the DTD for one of these documents contains this para element description:
<!ELEMENT para (#PCDATA|image)*>
Which I would like to define with:
#[derive(Clone, Debug, XmlRead)]
#[xml(tag = "allinstrs")]
pub struct AllInstructions {
#[xml(child = "para")]
pub paragraph: Vec<ParagraphChild>,
}
#[derive(Clone, Debug, XmlRead)]
pub enum ParagraphChild {
#[xml(tag = "image")]
Image(Image),
#[xml(text)]
Text(String),
}
However, because derived enums cannot accept #[xml(text)] I cannot read in the text content. Is this a current limitation, or is there another strategy I'm not seeing?