Struct sxd_document::dom::Element
source · 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)where
N: Into<QName<'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)where
I: IntoIterator,
I::Item: Into<ChildOfElement<'d>>,
pub fn replace_children<I>(&self, children: I)where
I: IntoIterator,
I::Item: Into<ChildOfElement<'d>>,
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>>where
N: Into<QName<'n>>,
pub fn attributes(&self) -> Vec<Attribute<'d>>
pub fn set_attribute_value<'n, N>(&self, name: N, value: &str) -> Attribute<'d>where
N: Into<QName<'n>>,
pub fn attribute_value<'n, N>(&self, name: N) -> Option<&'d str>where
N: Into<QName<'n>>,
pub fn remove_attribute<'n, N>(&self, name: N)where
N: Into<QName<'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.