use core::{fmt, ops::Range};
#[derive(Clone)]
pub struct XmlDoctype<'xml> {
pub(crate) xml_text: &'xml str,
pub(crate) range: Range<usize>,
}
impl<'xml> XmlDoctype<'xml> {
#[must_use]
pub fn content(&self) -> &'xml str {
let s = &self.xml_text[self.range.clone()];
s[9..s.len() - 1].trim()
}
#[must_use]
pub fn range(&self) -> Range<usize> {
self.range.clone()
}
}
impl fmt::Debug for XmlDoctype<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("XmlDoctype")
.field("content", &self.content())
.field("range", &self.range)
.finish()
}
}