[−][src]Struct libxml::tree::node::Node
An xml node
Methods
impl Node
[src]
impl Node
pub fn new(
name: &str,
ns: Option<Namespace>,
doc: &Document
) -> Result<Self, ()>
[src]
pub fn new(
name: &str,
ns: Option<Namespace>,
doc: &Document
) -> Result<Self, ()>
Create a new node, bound to a given document.
pub fn node_ptr(&self) -> xmlNodePtr
[src]
pub fn node_ptr(&self) -> xmlNodePtr
Immutably borrows the underlying libxml2 xmlNodePtr
pointer
pub fn node_ptr_mut(&mut self) -> Result<xmlNodePtr, String>
[src]
pub fn node_ptr_mut(&mut self) -> Result<xmlNodePtr, String>
Mutably borrows the underlying libxml2 xmlNodePtr
pointer
Also protects against mutability conflicts at runtime.
pub fn new_text(content: &str, doc: &Document) -> Result<Self, ()>
[src]
pub fn new_text(content: &str, doc: &Document) -> Result<Self, ()>
Create a new text node, bound to a given document
pub fn mock(doc: &Document) -> Self
[src]
pub fn mock(doc: &Document) -> Self
Create a mock node, used for a placeholder argument
pub fn null() -> Self
[src]
pub fn null() -> Self
Create a mock node, used for a placeholder argument
pub fn to_hashable(&self) -> usize
[src]
pub fn to_hashable(&self) -> usize
libc::c_void
isn't hashable and cannot be made hashable
pub fn get_next_sibling(&self) -> Option<Node>
[src]
pub fn get_next_sibling(&self) -> Option<Node>
Returns the next sibling if it exists
pub fn get_prev_sibling(&self) -> Option<Node>
[src]
pub fn get_prev_sibling(&self) -> Option<Node>
Returns the previous sibling if it exists
pub fn get_first_child(&self) -> Option<Node>
[src]
pub fn get_first_child(&self) -> Option<Node>
Returns the first child if it exists
pub fn get_first_element_child(&self) -> Option<Node>
[src]
pub fn get_first_element_child(&self) -> Option<Node>
Returns the first element child if it exists
pub fn get_last_child(&self) -> Option<Node>
[src]
pub fn get_last_child(&self) -> Option<Node>
Returns the last child if it exists
pub fn get_child_nodes(&self) -> Vec<Node>
[src]
pub fn get_child_nodes(&self) -> Vec<Node>
Returns all child nodes of the given node as a vector
pub fn get_child_elements(&self) -> Vec<Node>
[src]
pub fn get_child_elements(&self) -> Vec<Node>
Returns all child elements of the given node as a vector
pub fn get_parent(&self) -> Option<Node>
[src]
pub fn get_parent(&self) -> Option<Node>
Returns the parent if it exists
pub fn get_type(&self) -> Option<NodeType>
[src]
pub fn get_type(&self) -> Option<NodeType>
Get the node type
pub fn add_prev_sibling(
&mut self,
new_sibling: &mut Node
) -> Result<(), Box<dyn Error>>
[src]
pub fn add_prev_sibling(
&mut self,
new_sibling: &mut Node
) -> Result<(), Box<dyn Error>>
Add a previous sibling
pub fn add_next_sibling(
&mut self,
new_sibling: &mut Node
) -> Result<(), Box<dyn Error>>
[src]
pub fn add_next_sibling(
&mut self,
new_sibling: &mut Node
) -> Result<(), Box<dyn Error>>
Add a next sibling
pub fn is_text_node(&self) -> bool
[src]
pub fn is_text_node(&self) -> bool
Returns true iff it is a text node
pub fn is_element_node(&self) -> bool
[src]
pub fn is_element_node(&self) -> bool
Checks if the given node is an Element
pub fn is_null(&self) -> bool
[src]
pub fn is_null(&self) -> bool
Checks if the underlying libxml2 pointer is NULL
pub fn get_name(&self) -> String
[src]
pub fn get_name(&self) -> String
Returns the name of the node (empty string if name pointer is NULL
)
pub fn set_name(&mut self, name: &str) -> Result<(), Box<dyn Error>>
[src]
pub fn set_name(&mut self, name: &str) -> Result<(), Box<dyn Error>>
Sets the name of this Node
pub fn get_content(&self) -> String
[src]
pub fn get_content(&self) -> String
Returns the content of the node (assumes UTF-8 XML document)
pub fn set_content(&mut self, content: &str) -> Result<(), Box<dyn Error>>
[src]
pub fn set_content(&mut self, content: &str) -> Result<(), Box<dyn Error>>
Sets the text content of this Node
pub fn get_property(&self, name: &str) -> Option<String>
[src]
pub fn get_property(&self, name: &str) -> Option<String>
Returns the value of property name
pub fn get_property_ns(&self, name: &str, ns: &str) -> Option<String>
[src]
pub fn get_property_ns(&self, name: &str, ns: &str) -> Option<String>
Returns the value of property name
in namespace ns
pub fn get_property_node(&self, name: &str) -> Option<Node>
[src]
pub fn get_property_node(&self, name: &str) -> Option<Node>
Return an attribute as a Node
struct of type AttributeNode
pub fn set_property(
&mut self,
name: &str,
value: &str
) -> Result<(), Box<dyn Error>>
[src]
pub fn set_property(
&mut self,
name: &str,
value: &str
) -> Result<(), Box<dyn Error>>
Sets the value of property name
to value
pub fn set_property_ns(
&mut self,
name: &str,
value: &str,
ns: &Namespace
) -> Result<(), Box<dyn Error>>
[src]
pub fn set_property_ns(
&mut self,
name: &str,
value: &str,
ns: &Namespace
) -> Result<(), Box<dyn Error>>
Sets a namespaced attribute
pub fn remove_property(&mut self, name: &str) -> Result<(), Box<dyn Error>>
[src]
pub fn remove_property(&mut self, name: &str) -> Result<(), Box<dyn Error>>
Removes the property of given name
pub fn get_attribute(&self, name: &str) -> Option<String>
[src]
pub fn get_attribute(&self, name: &str) -> Option<String>
Alias for get_property
pub fn get_attribute_ns(&self, name: &str, ns: &str) -> Option<String>
[src]
pub fn get_attribute_ns(&self, name: &str, ns: &str) -> Option<String>
Alias for get_property_ns
pub fn get_attribute_node(&self, name: &str) -> Option<Node>
[src]
pub fn get_attribute_node(&self, name: &str) -> Option<Node>
Alias for get_property_node
pub fn set_attribute(
&mut self,
name: &str,
value: &str
) -> Result<(), Box<dyn Error>>
[src]
pub fn set_attribute(
&mut self,
name: &str,
value: &str
) -> Result<(), Box<dyn Error>>
Alias for set_property
pub fn set_attribute_ns(
&mut self,
name: &str,
value: &str,
ns: &Namespace
) -> Result<(), Box<dyn Error>>
[src]
pub fn set_attribute_ns(
&mut self,
name: &str,
value: &str,
ns: &Namespace
) -> Result<(), Box<dyn Error>>
Alias for set_property_ns
pub fn remove_attribute(&mut self, name: &str) -> Result<(), Box<dyn Error>>
[src]
pub fn remove_attribute(&mut self, name: &str) -> Result<(), Box<dyn Error>>
Alias for remove_property
pub fn get_properties(&self) -> HashMap<String, String>
[src]
pub fn get_properties(&self) -> HashMap<String, String>
Get a copy of the attributes of this node
pub fn get_attributes(&self) -> HashMap<String, String>
[src]
pub fn get_attributes(&self) -> HashMap<String, String>
Alias for get_properties
pub fn get_namespace(&self) -> Option<Namespace>
[src]
pub fn get_namespace(&self) -> Option<Namespace>
Gets the active namespace associated of this node
pub fn get_namespaces(&self, doc: &Document) -> Vec<Namespace>
[src]
pub fn get_namespaces(&self, doc: &Document) -> Vec<Namespace>
Gets a list of namespaces associated with this node
pub fn get_namespace_declarations(&self) -> Vec<Namespace>
[src]
pub fn get_namespace_declarations(&self) -> Vec<Namespace>
Get a list of namespaces declared with this node
pub fn set_namespace(
&mut self,
namespace: &Namespace
) -> Result<(), Box<dyn Error>>
[src]
pub fn set_namespace(
&mut self,
namespace: &Namespace
) -> Result<(), Box<dyn Error>>
Sets a Namespace
for the node
pub fn lookup_namespace_prefix(&self, href: &str) -> Option<String>
[src]
pub fn lookup_namespace_prefix(&self, href: &str) -> Option<String>
Looks up the prefix of a namespace from its URI, basedo around a given Node
pub fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>
[src]
pub fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>
Looks up the uri of a namespace from its prefix, basedo around a given Node
pub fn recursively_remove_namespaces(&mut self) -> Result<(), Box<dyn Error>>
[src]
pub fn recursively_remove_namespaces(&mut self) -> Result<(), Box<dyn Error>>
Removes the namespaces of this Node
and it's children!
pub fn get_class_names(&self) -> HashSet<String>
[src]
pub fn get_class_names(&self) -> HashSet<String>
Get a set of class names from this node's attributes
pub fn add_child(&mut self, child: &mut Node) -> Result<(), String>
[src]
pub fn add_child(&mut self, child: &mut Node) -> Result<(), String>
Creates a new Node
as child to the self Node
pub fn new_child(
&mut self,
ns: Option<Namespace>,
name: &str
) -> Result<Node, Box<dyn Error>>
[src]
pub fn new_child(
&mut self,
ns: Option<Namespace>,
name: &str
) -> Result<Node, Box<dyn Error>>
Creates a new Node
as child to the self Node
pub fn add_text_child(
&mut self,
ns: Option<Namespace>,
name: &str,
content: &str
) -> Result<Node, Box<dyn Error>>
[src]
pub fn add_text_child(
&mut self,
ns: Option<Namespace>,
name: &str,
content: &str
) -> Result<Node, Box<dyn Error>>
Adds a new text child, to this Node
pub fn append_text(&mut self, content: &str) -> Result<(), Box<dyn Error>>
[src]
pub fn append_text(&mut self, content: &str) -> Result<(), Box<dyn Error>>
Append text to this Node
pub fn unlink_node(&mut self)
[src]
pub fn unlink_node(&mut self)
Unbinds the Node from its siblings and Parent, but not from the Document it belongs to. If the node is not inserted into the DOM afterwards, it will be lost after the program terminates. From a low level view, the unbound node is stripped from the context it is and inserted into a (hidden) document-fragment.
pub fn unlink(&mut self)
[src]
pub fn unlink(&mut self)
Alias for unlink_node
pub fn unbind_node(&mut self)
[src]
pub fn unbind_node(&mut self)
Alias for unlink_node
pub fn unbind(&mut self)
[src]
pub fn unbind(&mut self)
Alias for unlink_node
pub fn is_unlinked(&self) -> bool
[src]
pub fn is_unlinked(&self) -> bool
Checks if node is marked as unlinked
pub fn findnodes(&self, xpath: &str) -> Result<Vec<Node>, ()>
[src]
pub fn findnodes(&self, xpath: &str) -> Result<Vec<Node>, ()>
find nodes via xpath, at a specified node or the document root
Trait Implementations
impl Clone for Node
[src]
impl Clone for Node
fn clone(&self) -> Node
[src]
fn clone(&self) -> Node
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Eq for Node
[src]
impl Eq for Node
impl PartialEq<Node> for Node
[src]
impl PartialEq<Node> for Node
fn eq(&self, other: &Node) -> bool
[src]
fn eq(&self, other: &Node) -> bool
Two nodes are considered equal, if they point to the same xmlNode.
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Hash for Node
[src]
impl Hash for Node
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash<H: Hasher>(&self, state: &mut H)
Generates a hash value from the node_ptr
value.
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for Node
[src]
impl Debug for Node
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more