Struct Context

Source
pub struct Context<'x> { /* private fields */ }
Expand description

§Parsing context for FromEventsBuilder

For the most part, FromEventsBuilder implementations can work with only the information inside the rxml::Event which is delivered to them (and any information they may have stored from previous events).

However, there is (currently) one special case: the xml:lang attribute. That attribute is inherited across the entire document tree hierarchy. If the parsed element is not the top-level element, there may be an implicit value for xml:lang.

Implementations§

Source§

impl<'x> Context<'x>

Source

pub fn empty() -> Self

A context suitable for the beginning of the document.

xml:lang is assumed to be unset.

Source

pub fn with_language(self, language: Option<&'x str>) -> Self

Set the effective xml:lang value on the context and return it.

Source

pub fn language(&self) -> Option<&str>

Return the xml:lang value in effect at the end of the event which is currently being processed.