pub enum XmlContent {
Element(XmlElement),
Text(XmlText),
Comment(XmlComment),
ProcessingInstruction(XmlProcessingInstruction),
}Expand description
Represents the content of an XML node.
Variants§
Element(XmlElement)
An XML element with a qualified name and attributes.
Text(XmlText)
XML text content.
Comment(XmlComment)
XML comment.
ProcessingInstruction(XmlProcessingInstruction)
XML processing instruction.
Implementations§
Source§impl XmlContent
impl XmlContent
Sourcepub fn info_size(&self) -> i32
pub fn info_size(&self) -> i32
Returns the information size of this content.
This metric is used for similarity calculations and copy detection.
Sourcepub fn content_equals(&self, other: &XmlContent) -> bool
pub fn content_equals(&self, other: &XmlContent) -> bool
Tests content equality using MD5 hash comparison.
Sourcepub fn content_hash(&self) -> i32
pub fn content_hash(&self) -> i32
Returns a 32-bit hash code for this content.
This is used for fast equality pre-checks and child list distance calculations.
Sourcepub fn is_element(&self) -> bool
pub fn is_element(&self) -> bool
Returns true if this is an element node.
Sourcepub fn is_comment(&self) -> bool
pub fn is_comment(&self) -> bool
Returns true if this is a comment node.
Sourcepub fn is_processing_instruction(&self) -> bool
pub fn is_processing_instruction(&self) -> bool
Returns true if this is a processing instruction node.
Sourcepub fn as_element(&self) -> Option<&XmlElement>
pub fn as_element(&self) -> Option<&XmlElement>
Returns a reference to the element, if this is an element node.
Sourcepub fn as_element_mut(&mut self) -> Option<&mut XmlElement>
pub fn as_element_mut(&mut self) -> Option<&mut XmlElement>
Returns a mutable reference to the element, if this is an element node.
Sourcepub fn as_text(&self) -> Option<&XmlText>
pub fn as_text(&self) -> Option<&XmlText>
Returns a reference to the text, if this is a text node.
Sourcepub fn as_text_mut(&mut self) -> Option<&mut XmlText>
pub fn as_text_mut(&mut self) -> Option<&mut XmlText>
Returns a mutable reference to the text, if this is a text node.
Sourcepub fn as_processing_instruction(&self) -> Option<&XmlProcessingInstruction>
pub fn as_processing_instruction(&self) -> Option<&XmlProcessingInstruction>
Returns a reference to the PI, if this is a processing instruction node.
Trait Implementations§
Source§impl Clone for XmlContent
impl Clone for XmlContent
Source§fn clone(&self) -> XmlContent
fn clone(&self) -> XmlContent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more