fix: preserve XML and raster import semantics after codec cutover

This commit is contained in:
Dylan M. Taylor
2026-11-14 23:25:19 +00:00
parent 1e1100a9ed
commit 5122a1f9d9
10 changed files with 249 additions and 57 deletions
+2 -1
View File
@@ -165,7 +165,8 @@ fn parse(xml: &str, name: &str, cmd: &str) -> Result<El> {
doctype: Doctype::Reject,
limits: Limits { max_depth: MAX_NESTING, max_nodes: MAX_NODES as usize, ..Limits::DEFAULT },
..Options::default()
};
}
.strict();
opts.parse(xml.as_bytes()).map_err(|e| match e {
craft_xml::Error::TooDeep(_) => bad(cmd, format!("`{name}` in the Word document nests elements more than {MAX_NESTING} deep")),
_ => bad(cmd, format!("`{name}` in the Word document is not well-formed XML: {e}")),
@@ -202,7 +202,8 @@ fn parse_library(xml: &str, cmd: &str) -> Result<Library> {
names: craft_xml::Names::Local,
limits: craft_xml::Limits { max_depth: MAX_LIBRARY_NESTING, max_nodes: MAX_LIBRARY_NODES as usize, ..craft_xml::Limits::DEFAULT },
..craft_xml::Options::default()
};
}
.strict();
let doc = opts.parse(xml.as_bytes()).map_err(|e| match e {
craft_xml::Error::TooDeep(_) => bad(cmd, format!("the variable library nests elements more than {MAX_LIBRARY_NESTING} deep")),
_ => bad(cmd, format!("the variable library is not well-formed XML: {e}")),