pub struct RawXmlElement {
pub name: String,
pub attributes: Vec<(String, String)>,
pub children: Vec<RawXmlNode>,
pub self_closing: bool,
}Expand description
A raw XML element with its name, attributes, and children preserved.
Fields§
§name: StringThe full element name (including namespace prefix if present).
attributes: Vec<(String, String)>Element attributes as (name, value) pairs.
children: Vec<RawXmlNode>Child nodes.
self_closing: boolWhether this was a self-closing element.
Implementations§
Source§impl RawXmlElement
impl RawXmlElement
Sourcepub fn from_reader<R: BufRead>(
reader: &mut Reader<R>,
start: &BytesStart<'_>,
) -> Result<Self>
pub fn from_reader<R: BufRead>( reader: &mut Reader<R>, start: &BytesStart<'_>, ) -> Result<Self>
Parse a raw XML element from a reader, starting after the opening tag.
The start parameter should be the BytesStart event that opened this element.
Sourcepub fn from_empty(start: &BytesStart<'_>) -> Self
pub fn from_empty(start: &BytesStart<'_>) -> Self
Create from an empty/self-closing element.
Sourcepub fn parse_as<T: FromXml>(&self) -> Result<T, ParseError>
pub fn parse_as<T: FromXml>(&self) -> Result<T, ParseError>
Parse this element as a typed struct using the FromXml trait.
Uses a streaming approach that generates XML bytes lazily from the in-memory tree structure, avoiding full upfront serialization.
§Example
ⓘ
use ooxml_dml::types::CTTable;
if let Some(table) = raw_element.parse_as::<CTTable>() {
// Use the parsed table
}Trait Implementations§
Source§impl Clone for RawXmlElement
impl Clone for RawXmlElement
Source§fn clone(&self) -> RawXmlElement
fn clone(&self) -> RawXmlElement
Returns a duplicate of the value. Read more
1.0.0 · 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 RawXmlElement
impl Debug for RawXmlElement
Source§impl PartialEq for RawXmlElement
impl PartialEq for RawXmlElement
impl StructuralPartialEq for RawXmlElement
Auto Trait Implementations§
impl Freeze for RawXmlElement
impl RefUnwindSafe for RawXmlElement
impl Send for RawXmlElement
impl Sync for RawXmlElement
impl Unpin for RawXmlElement
impl UnsafeUnpin for RawXmlElement
impl UnwindSafe for RawXmlElement
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