[−][src]Struct xdoc::Element
Represents an Element in an XML Document.
Fields
namespace: Option<String>
The namespace of this element. e.g. in foo:bar
, foo
is the namespace.
name: String
The name of this element. e.g. in foo:bar
, bar
is the name.
attributes: OrdMap
Attributes of this element.
nodes: Vec<Node>
Children of this element.
Implementations
impl Element
[src]
pub fn from_name<S: AsRef<str>>(name: S) -> Self
[src]
Create a new element using the given name.
pub fn children(&self) -> impl Iterator<Item = &Element>
[src]
Returns the 'child' elements of the current element. Consider the XML document:
<r>
<a/>
<b/>
</r>
r's children()
function would return an iterator over 'a' and 'b'.
Text nodes, processing instructions and comments are skipped/ignored by the iterator.
pub fn add_child(&mut self, element: Element)
[src]
Add an element as a child of this element.
pub fn fullname(&self) -> String
[src]
The fullname of the element (including both the namespace and the name).
pub fn has_children(&self) -> bool
[src]
Does this element have any sub elements. For example, if the element is empty or contains only text and/or pis and/or comments, then false. if the element has elements, then true.
pub fn is_text(&self) -> bool
[src]
Returns true if there is exactly one sub node, and that sub node is either text or cdata.
pub fn write<W>(
&self,
writer: &mut W,
opts: &WriteOpts,
depth: usize
) -> Result<()> where
W: Write,
[src]
&self,
writer: &mut W,
opts: &WriteOpts,
depth: usize
) -> Result<()> where
W: Write,
Write the element to the Write
object.
Trait Implementations
impl Clone for Element
[src]
impl Debug for Element
[src]
impl Default for Element
[src]
impl Eq for Element
[src]
impl<'a> From<&'a Element> for Cow<'a, Element>
[src]
impl<'a> From<Element> for Cow<'a, Element>
[src]
impl Hash for Element
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Element> for Element
[src]
impl PartialOrd<Element> for Element
[src]
fn partial_cmp(&self, other: &Element) -> Option<Ordering>
[src]
fn lt(&self, other: &Element) -> bool
[src]
fn le(&self, other: &Element) -> bool
[src]
fn gt(&self, other: &Element) -> bool
[src]
fn ge(&self, other: &Element) -> bool
[src]
impl StructuralEq for Element
[src]
impl StructuralPartialEq for Element
[src]
Auto Trait Implementations
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,