use std::io::Read;
use reader::EventReader;
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct ParserConfig {
pub trim_whitespace: bool,
pub whitespace_to_characters: bool,
pub cdata_to_characters: bool,
pub ignore_comments: bool,
pub coalesce_characters: bool
}
impl ParserConfig {
pub fn new() -> ParserConfig {
ParserConfig {
trim_whitespace: false,
whitespace_to_characters: false,
cdata_to_characters: false,
ignore_comments: true,
coalesce_characters: true
}
}
#[inline]
pub fn create_reader<R: Read>(self, source: R) -> EventReader<R> {
EventReader::new_with_config(source, self)
}
}
impl Default for ParserConfig {
#[inline]
fn default() -> ParserConfig {
ParserConfig::new()
}
}
gen_setters! { ParserConfig,
trim_whitespace: val bool,
whitespace_to_characters: val bool,
cdata_to_characters: val bool,
ignore_comments: val bool,
coalesce_characters: val bool
}