#[cfg(feature = "libxml_output")]
use std::io::Write;
#[repr(C)]
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct XmlNotation {
name: String,
pub(crate) public_id: Option<String>,
pub(crate) system_id: Option<String>,
}
impl XmlNotation {
pub(crate) fn new(name: &str, public_id: Option<&str>, system_id: Option<&str>) -> Self {
Self {
name: name.to_owned(),
public_id: public_id.map(|p| p.to_owned()),
system_id: system_id.map(|s| s.to_owned()),
}
}
}
#[doc(alias = "xmlDumpNotationDecl")]
#[cfg(feature = "libxml_output")]
pub fn xml_dump_notation_decl<'a>(out: &mut (impl Write + 'a), nota: &XmlNotation) {
use crate::io::write_quoted;
write!(out, "<!NOTATION {}", nota.name).ok();
if let Some(public_id) = nota.public_id.as_deref() {
write!(out, " PUBLIC ").ok();
write_quoted(out, public_id).ok();
if let Some(system_id) = nota.system_id.as_deref() {
write!(out, " ").ok();
write_quoted(out, system_id).ok();
}
} else {
write!(out, " SYSTEM ").ok();
write_quoted(out, nota.system_id.as_deref().unwrap()).ok();
}
writeln!(out, " >").ok();
}