pub struct XmlElement {
pub name: String,
pub namespace: Option<String>,
pub attributes: BTreeMap<String, String>,
pub children: Vec<XmlElement>,
pub text: String,
}Expand description
A single XML element per §7.1.4 / §7.1.5 (element + attributes).
Fields§
§name: StringLocal tag name (without the namespace prefix).
namespace: Option<String>Optional namespace URI per §7.1.3.
attributes: BTreeMap<String, String>Attributes (name -> value, alphabetically sorted via BTreeMap for deterministic iteration).
children: Vec<XmlElement>Child elements in document order.
text: StringDirect text content (contiguous text part immediately before the first child element). Empty if no text is present.
Implementations§
Source§impl XmlElement
impl XmlElement
Sourcepub fn child(&self, name: &str) -> Option<&XmlElement>
pub fn child(&self, name: &str) -> Option<&XmlElement>
Returns the first child with the given local name, if present.
Sourcepub fn children_named<'a>(
&'a self,
name: &'a str,
) -> impl Iterator<Item = &'a XmlElement> + 'a
pub fn children_named<'a>( &'a self, name: &'a str, ) -> impl Iterator<Item = &'a XmlElement> + 'a
Returns all children with the given local name.
Sourcepub fn attribute(&self, name: &str) -> Option<&str>
pub fn attribute(&self, name: &str) -> Option<&str>
Returns the value of an attribute, if present.
Sourcepub fn sequence_elements(&self) -> impl Iterator<Item = &XmlElement> + '_
pub fn sequence_elements(&self) -> impl Iterator<Item = &XmlElement> + '_
Iterates over <element> children per Spec §7.2.4.1
(IDL sequence mapping) and §7.2.5 (IDL array mapping = sequence
mapping with the same element tag).
Spec OMG DDS-XML 1.0 §7.2.4.1: “The complexType contains zero or more elements named element. Nested inside each element is the XSD schema obtained from mapping the IDL type of the element itself.”
Spec §7.2.5: “The XML representation of IDL arrays is the same
as it would be for IDL sequences of the same element type.” —
i.e. the <element> tag is also used for arrays.
Used by the IDL-PSM mapping (qos_parser, sample) to
iterate generic sequences/arrays.
Trait Implementations§
Source§impl Clone for XmlElement
impl Clone for XmlElement
Source§fn clone(&self) -> XmlElement
fn clone(&self) -> XmlElement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for XmlElement
impl Debug for XmlElement
Source§impl Default for XmlElement
impl Default for XmlElement
Source§fn default() -> XmlElement
fn default() -> XmlElement
impl Eq for XmlElement
Source§impl PartialEq for XmlElement
impl PartialEq for XmlElement
Source§fn eq(&self, other: &XmlElement) -> bool
fn eq(&self, other: &XmlElement) -> bool
self and other values to be equal, and is used by ==.