pub struct XmlDocument<S> { /* private fields */ }Expand description
An immutable XML tree whose nodes reference ranges in source whenever possible.
S may be &[u8], Arc<[u8]>, Vec<u8>, or another byte container.
Implementations§
Source§impl<S: AsRef<[u8]>> XmlDocument<S>
impl<S: AsRef<[u8]>> XmlDocument<S>
Sourcepub fn parse(source: S) -> Result<Self, Error>
pub fn parse(source: S) -> Result<Self, Error>
Parses a complete XML document with the default bounded policy.
Sourcepub fn parse_with_options(
source: S,
options: &ParseOptions,
) -> Result<Self, Error>
pub fn parse_with_options( source: S, options: &ParseOptions, ) -> Result<Self, Error>
Parses a complete XML document into a flat arena.
pub fn source(&self) -> &[u8] ⓘ
pub fn into_source(self) -> S
pub fn root(&self) -> ElementRef<'_, S>
pub fn node(&self, id: NodeId) -> Option<NodeRef<'_, S>>
pub fn node_count(&self) -> usize
pub fn allocated_value_count(&self) -> usize
pub fn write_original<W: Write>(&self, writer: W) -> Result<(), Error>
Source§impl XmlDocument<Arc<[u8]>>
impl XmlDocument<Arc<[u8]>>
Sourcepub fn from_reader<R: Read>(reader: R) -> Result<Self, Error>
pub fn from_reader<R: Read>(reader: R) -> Result<Self, Error>
Reads and parses a complete document with the default bounded policy.
Sourcepub fn from_reader_with_options<R: Read>(
reader: R,
options: &ParseOptions,
) -> Result<Self, Error>
pub fn from_reader_with_options<R: Read>( reader: R, options: &ParseOptions, ) -> Result<Self, Error>
Reads at most one byte beyond the configured limit before parsing an owned document.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for XmlDocument<S>where
S: Freeze,
impl<S> RefUnwindSafe for XmlDocument<S>where
S: RefUnwindSafe,
impl<S> Send for XmlDocument<S>where
S: Send,
impl<S> Sync for XmlDocument<S>where
S: Sync,
impl<S> Unpin for XmlDocument<S>where
S: Unpin,
impl<S> UnsafeUnpin for XmlDocument<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for XmlDocument<S>where
S: UnwindSafe,
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