pub struct ParseOptions {
pub process_entities: bool,
pub whitespace: Whitespace,
pub max_depth: u32,
}Expand description
Options for parsing XML documents.
Replaces TinyXML2’s XMLDocument constructor parameters with a builder-style
options struct for clarity and extensibility.
§Examples
use tinyxml2::{ParseOptions, Whitespace};
let opts = ParseOptions::new()
.with_whitespace(Whitespace::Collapse)
.with_process_entities(false)
.with_max_depth(100);Fields§
§process_entities: boolWhether to process XML entities during parsing.
When true (default), entity references like & are decoded.
When false, entity text is preserved as-is.
whitespace: WhitespaceWhitespace handling mode.
max_depth: u32Maximum allowed element nesting depth.
Prevents stack overflow on deeply nested (potentially malicious) input.
Default is 500, matching TinyXML2’s TINYXML2_MAX_ELEMENT_DEPTH.
Implementations§
Source§impl ParseOptions
impl ParseOptions
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates default parse options.
process_entities:truewhitespace:Whitespace::Preservemax_depth: 500
Sourcepub const fn with_whitespace(self, whitespace: Whitespace) -> Self
pub const fn with_whitespace(self, whitespace: Whitespace) -> Self
Sets the whitespace handling mode.
Sourcepub const fn with_process_entities(self, process: bool) -> Self
pub const fn with_process_entities(self, process: bool) -> Self
Sets whether entities should be processed during parsing.
Sourcepub const fn with_max_depth(self, depth: u32) -> Self
pub const fn with_max_depth(self, depth: u32) -> Self
Sets the maximum element nesting depth.
Trait Implementations§
Source§impl Clone for ParseOptions
impl Clone for ParseOptions
Source§fn clone(&self) -> ParseOptions
fn clone(&self) -> ParseOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ParseOptions
impl Debug for ParseOptions
Auto Trait Implementations§
impl Freeze for ParseOptions
impl RefUnwindSafe for ParseOptions
impl Send for ParseOptions
impl Sync for ParseOptions
impl Unpin for ParseOptions
impl UnsafeUnpin for ParseOptions
impl UnwindSafe for ParseOptions
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
Mutably borrows from an owned value. Read more