mirror of
https://github.com/typst/typst
synced 2025-05-21 12:35:29 +08:00
Allow DTD in XML parsing (#3534)
This commit is contained in:
parent
1e2c239971
commit
dadd657e0a
@ -1,4 +1,5 @@
|
|||||||
use ecow::EcoString;
|
use ecow::EcoString;
|
||||||
|
use roxmltree::ParsingOptions;
|
||||||
|
|
||||||
use crate::diag::{format_xml_like_error, At, FileError, SourceResult};
|
use crate::diag::{format_xml_like_error, At, FileError, SourceResult};
|
||||||
use crate::engine::Engine;
|
use crate::engine::Engine;
|
||||||
@ -80,8 +81,12 @@ impl xml {
|
|||||||
let text = std::str::from_utf8(data.as_slice())
|
let text = std::str::from_utf8(data.as_slice())
|
||||||
.map_err(FileError::from)
|
.map_err(FileError::from)
|
||||||
.at(span)?;
|
.at(span)?;
|
||||||
let document =
|
let document = roxmltree::Document::parse_with_options(
|
||||||
roxmltree::Document::parse(text).map_err(format_xml_error).at(span)?;
|
text,
|
||||||
|
ParsingOptions { allow_dtd: true, ..Default::default() },
|
||||||
|
)
|
||||||
|
.map_err(format_xml_error)
|
||||||
|
.at(span)?;
|
||||||
Ok(convert_xml(document.root()))
|
Ok(convert_xml(document.root()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user