struct XmlReader<'i, R: XmlRead<'i>, E: EntityResolver = PredefinedEntityResolver> {
reader: R,
lookahead: Result<PayloadEvent<'i>, DeError>,
entity_resolver: E,
}
Expand description
An intermediate reader that consumes PayloadEvent
s and produces final DeEvent
s.
PayloadEvent::Text
events, that followed by any event except
PayloadEvent::Text
or PayloadEvent::CData
, are trimmed from the end.
Fields§
§reader: R
A source of low-level XML events
lookahead: Result<PayloadEvent<'i>, DeError>
Intermediate event, that could be returned by the next call to next()
.
If that is the Text
event then leading spaces already trimmed, but
trailing spaces is not. Before the event will be returned, trimming of
the spaces could be necessary
entity_resolver: E
Used to resolve unknown entities that would otherwise cause the parser
to return an EscapeError::UnrecognizedEntity
error.
Implementations§
Source§impl<'i, R: XmlRead<'i>, E: EntityResolver> XmlReader<'i, R, E>
impl<'i, R: XmlRead<'i>, E: EntityResolver> XmlReader<'i, R, E>
fn new(reader: R, entity_resolver: E) -> Self
Sourcefn next_impl(&mut self) -> Result<PayloadEvent<'i>, DeError>
fn next_impl(&mut self) -> Result<PayloadEvent<'i>, DeError>
Read next event and put it in lookahead, return the current lookahead
Sourceconst fn current_event_is_last_text(&self) -> bool
const fn current_event_is_last_text(&self) -> bool
Returns true
when next event is not a text event in any form.
Sourcefn drain_text(&mut self, result: Cow<'i, str>) -> Result<DeEvent<'i>, DeError>
fn drain_text(&mut self, result: Cow<'i, str>) -> Result<DeEvent<'i>, DeError>
Read all consequent Text
and CData
events until non-text event
occurs. Content of all events would be appended to result
and returned
as DeEvent::Text
.