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