Enum quick_xml::parser::ElementParser
source · pub enum ElementParser {
Outside,
SingleQ,
DoubleQ,
}
Expand description
A parser that search a >
symbol in the slice outside of quoted regions.
The parser considers two quoted regions: a double-quoted ("..."
) and
a single-quoted ('...'
) region. Matches found inside those regions are not
considered as results. Each region starts and ends by its quote symbol,
which cannot be escaped (but can be encoded as XML character entity or named
entity. Anyway, that encoding does not contain literal quotes).
To use a parser create an instance of parser and feed
data into it.
After successful search the parser will return Some
with position of
found symbol. If search is unsuccessful, a None
will be returned. You
typically would expect positive result of search, so that you should feed
new data until you get it.
NOTE: after successful match the parser does not returned to the initial state and should not be used anymore. Create a new parser if you want to perform new search.
§Example
use quick_xml::parser::{ElementParser, Parser};
let mut parser = ElementParser::default();
// Parse `<my-element with = 'some > inside'>and the text follow...`
// splitted into three chunks
assert_eq!(parser.feed(b"<my-element"), None);
// ...get new chunk of data
assert_eq!(parser.feed(b" with = 'some >"), None);
// ...get another chunk of data
assert_eq!(parser.feed(b" inside'>and the text follow..."), Some(8));
// ^ ^
// 0 8
Variants§
Outside
The initial state (inside element, but outside of attribute value).
SingleQ
Inside a single-quoted region ('...'
).
DoubleQ
Inside a double-quoted region ("..."
).
Trait Implementations§
source§impl Clone for ElementParser
impl Clone for ElementParser
source§fn clone(&self) -> ElementParser
fn clone(&self) -> ElementParser
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ElementParser
impl Debug for ElementParser
source§impl Default for ElementParser
impl Default for ElementParser
source§impl Parser for ElementParser
impl Parser for ElementParser
source§impl PartialEq for ElementParser
impl PartialEq for ElementParser
impl Copy for ElementParser
impl Eq for ElementParser
impl StructuralPartialEq for ElementParser
Auto Trait Implementations§
impl Freeze for ElementParser
impl RefUnwindSafe for ElementParser
impl Send for ElementParser
impl Sync for ElementParser
impl Unpin for ElementParser
impl UnwindSafe for ElementParser
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)