pub struct Element<'d> { /* private fields */ }Expand description
Elements are the workhorse of a document and may contain any type of node, except for the Root node
Implementations§
Source§impl<'d> Element<'d>
impl<'d> Element<'d>
pub fn name(&self) -> QName<'d>
pub fn set_name<'n, N>(&self, name: N)
pub fn set_default_namespace_uri(&self, namespace_uri: Option<&str>)
pub fn default_namespace_uri(&self) -> Option<&'d str>
pub fn recursive_default_namespace_uri(&self) -> Option<&'d str>
Sourcepub fn register_prefix(&self, prefix: &str, namespace_uri: &str)
pub fn register_prefix(&self, prefix: &str, namespace_uri: &str)
Map a prefix to a namespace URI. Any existing prefix on this element will be replaced.
Sourcepub fn namespace_uri_for_prefix(&self, prefix: &str) -> Option<&'d str>
pub fn namespace_uri_for_prefix(&self, prefix: &str) -> Option<&'d str>
Recursively resolve the prefix to a namespace URI.
Sourcepub fn prefix_for_namespace_uri(
&self,
namespace_uri: &str,
preferred: Option<&str>,
) -> Option<&'d str>
pub fn prefix_for_namespace_uri( &self, namespace_uri: &str, preferred: Option<&str>, ) -> Option<&'d str>
Recursively find a prefix for the namespace URI. Since
multiple prefixes may map to the same URI, preferred can be
provided to select a specific prefix, if it is valid.
Sourcepub fn namespaces_in_scope(&self) -> Vec<Namespace<'d>>
pub fn namespaces_in_scope(&self) -> Vec<Namespace<'d>>
Retrieve all namespaces that are in scope, recursively walking up the document tree.
pub fn preferred_prefix(&self) -> Option<&'d str>
pub fn set_preferred_prefix(&self, prefix: Option<&str>)
pub fn parent(&self) -> Option<ParentOfChild<'d>>
pub fn remove_from_parent(&self)
pub fn append_child<C>(&self, child: C)where
C: Into<ChildOfElement<'d>>,
pub fn append_children<I>(&self, children: I)
pub fn replace_children<I>(&self, children: I)
pub fn remove_child<C>(&self, child: C)where
C: Into<ChildOfElement<'d>>,
pub fn clear_children(&self)
pub fn children(&self) -> Vec<ChildOfElement<'d>>
pub fn preceding_siblings(&self) -> Vec<ChildOfElement<'d>>
pub fn following_siblings(&self) -> Vec<ChildOfElement<'d>>
pub fn attribute<'n, N>(&self, name: N) -> Option<Attribute<'d>>
pub fn attributes(&self) -> Vec<Attribute<'d>>
pub fn set_attribute_value<'n, N>(&self, name: N, value: &str) -> Attribute<'d>
pub fn attribute_value<'n, N>(&self, name: N) -> Option<&'d str>
pub fn remove_attribute<'n, N>(&self, name: N)
pub fn set_text(&self, text: &str) -> Text<'_>
Trait Implementations§
Source§impl<'a, 'd> From<&'a Element<'d>> for ChildOfElement<'d>
impl<'a, 'd> From<&'a Element<'d>> for ChildOfElement<'d>
Source§fn from(v: &'a Element<'d>) -> ChildOfElement<'d>
fn from(v: &'a Element<'d>) -> ChildOfElement<'d>
Converts to this type from the input type.
Source§impl<'a, 'd> From<&'a Element<'d>> for ChildOfRoot<'d>
impl<'a, 'd> From<&'a Element<'d>> for ChildOfRoot<'d>
Source§fn from(v: &'a Element<'d>) -> ChildOfRoot<'d>
fn from(v: &'a Element<'d>) -> ChildOfRoot<'d>
Converts to this type from the input type.
Source§impl<'d> From<Element<'d>> for ChildOfElement<'d>
impl<'d> From<Element<'d>> for ChildOfElement<'d>
Source§fn from(v: Element<'d>) -> ChildOfElement<'d>
fn from(v: Element<'d>) -> ChildOfElement<'d>
Converts to this type from the input type.
Source§impl<'d> From<Element<'d>> for ChildOfRoot<'d>
impl<'d> From<Element<'d>> for ChildOfRoot<'d>
Source§fn from(v: Element<'d>) -> ChildOfRoot<'d>
fn from(v: Element<'d>) -> ChildOfRoot<'d>
Converts to this type from the input type.
impl<'d> Copy for Element<'d>
impl<'d> Eq for Element<'d>
Auto Trait Implementations§
impl<'d> Freeze for Element<'d>
impl<'d> !RefUnwindSafe for Element<'d>
impl<'d> !Send for Element<'d>
impl<'d> !Sync for Element<'d>
impl<'d> Unpin for Element<'d>
impl<'d> !UnwindSafe for Element<'d>
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