minidom: Remove comments support. Forbid them as per XMPP RFC.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2020-03-26 19:50:34 +01:00
commit 015d0007fc
No known key found for this signature in database
GPG key ID: DEDA74AEECA9D0F2
5 changed files with 13 additions and 76 deletions

View file

@ -36,8 +36,7 @@ pub enum Error {
InvalidElement,
/// An error which is returned when a comment is to be parsed by minidom
#[cfg(not(comments))]
CommentsDisabled,
NoComments,
}
impl StdError for Error {
@ -49,8 +48,7 @@ impl StdError for Error {
Error::EndOfDocument => None,
Error::InvalidElementClosed => None,
Error::InvalidElement => None,
#[cfg(not(comments))]
Error::CommentsDisabled => None,
Error::NoComments => None,
}
}
}
@ -68,10 +66,9 @@ impl std::fmt::Display for Error {
write!(fmt, "the XML is invalid, an element was wrongly closed")
}
Error::InvalidElement => write!(fmt, "the XML element is invalid"),
#[cfg(not(comments))]
Error::CommentsDisabled => write!(
Error::NoComments => write!(
fmt,
"a comment has been found even though comments are disabled by feature"
"a comment has been found even though comments are forbidden"
),
}
}