From c8ed16a2d1d1f1b5278936eeadeae87da7cb104e Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Tue, 19 Nov 2024 14:52:14 +0000 Subject: store only namespace name in qualified name, not namespace declaration --- src/xml/parsers_complete.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/xml/parsers_complete.rs') diff --git a/src/xml/parsers_complete.rs b/src/xml/parsers_complete.rs index b057f62..900a3dd 100644 --- a/src/xml/parsers_complete.rs +++ b/src/xml/parsers_complete.rs @@ -30,6 +30,19 @@ pub trait Parser<'s> { type Output; fn parse(input: &'s str) -> IResult<&str, Self::Output>; + + fn parse_full(input: &'s str) -> crate::Result { + match ::parse(input) { + Ok((rest, output)) => { + if rest.is_empty() { + return Ok(output); + } else { + return Err(crate::error::Error::ExtraData(rest.to_string())); + } + } + Result::Err(e) => return Err(crate::error::Error::ParseError(e.to_string())), + } + } } /// [1] NSAttName ::= PrefixedAttName | DefaultAttName -- cgit