Struct libxml::tree::node::Node [−][src]
An xml node
Implementations
impl Node
[src]
pub fn new(
name: &str,
ns: Option<Namespace>,
doc: &Document
) -> Result<Self, ()>
[src]
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]
Immutably borrows the underlying libxml2 xmlNodePtr
pointer
pub fn node_ptr_mut(&mut self) -> Result<xmlNodePtr, String>
[src]
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]
Create a new text node, bound to a given document
pub fn mock(doc: &Document) -> Self
[src]
Create a mock node, used for a placeholder argument
pub fn null() -> Self
[src]
Create a mock node, used for a placeholder argument
pub fn to_hashable(&self) -> usize
[src]
libc::c_void
isn’t hashable and cannot be made hashable
pub fn get_next_sibling(&self) -> Option<Node>
[src]
Returns the next sibling if it exists
pub fn get_prev_sibling(&self) -> Option<Node>
[src]
Returns the previous sibling if it exists
pub fn get_first_child(&self) -> Option<Node>
[src]
Returns the first child if it exists
pub fn get_last_child(&self) -> Option<Node>
[src]
Returns the last child if it exists
pub fn get_next_element_sibling(&self) -> Option<Node>
[src]
Returns the next element sibling if it exists
pub fn get_prev_element_sibling(&self) -> Option<Node>
[src]
Returns the previous element sibling if it exists
pub fn get_first_element_child(&self) -> Option<Node>
[src]
Returns the first element child if it exists
pub fn get_last_element_child(&self) -> Option<Node>
[src]
Returns the last element child if it exists
pub fn get_child_nodes(&self) -> Vec<Node>
[src]
Returns all child nodes of the given node as a vector
pub fn get_child_elements(&self) -> Vec<Node>
[src]
Returns all child elements of the given node as a vector
pub fn get_parent(&self) -> Option<Node>
[src]
Returns the parent if it exists
pub fn get_type(&self) -> Option<NodeType>
[src]
Get the node type
pub fn add_prev_sibling(
&mut self,
new_sibling: &mut Node
) -> Result<(), Box<dyn Error>>
[src]
&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]
&mut self,
new_sibling: &mut Node
) -> Result<(), Box<dyn Error>>
Add a next sibling
pub fn is_text_node(&self) -> bool
[src]
Returns true iff it is a text node
pub fn is_element_node(&self) -> bool
[src]
Checks if the given node is an Element
pub fn is_null(&self) -> bool
[src]
Checks if the underlying libxml2 pointer is NULL
pub fn get_name(&self) -> String
[src]
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]
Sets the name of this Node
pub fn get_content(&self) -> String
[src]
Returns the content of the node (assumes UTF-8 XML document)
pub fn set_content(&mut self, content: &str) -> Result<(), Box<dyn Error>>
[src]
Sets the text content of this Node
pub fn get_property(&self, name: &str) -> Option<String>
[src]
Returns the value of property name
pub fn get_property_ns(&self, name: &str, ns: &str) -> Option<String>
[src]
Returns the value of property name
in namespace ns
pub fn get_property_node(&self, name: &str) -> Option<Node>
[src]
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]
&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]
&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]
Removes the property of given name
pub fn remove_property_ns(
&mut self,
name: &str,
ns: &str
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
name: &str,
ns: &str
) -> Result<(), Box<dyn Error>>
Removes the property of given name
and namespace (ns
)
pub fn get_attribute(&self, name: &str) -> Option<String>
[src]
Alias for get_property
pub fn get_attribute_ns(&self, name: &str, ns: &str) -> Option<String>
[src]
Alias for get_property_ns
pub fn get_attribute_node(&self, name: &str) -> Option<Node>
[src]
Alias for get_property_node
pub fn set_attribute(
&mut self,
name: &str,
value: &str
) -> Result<(), Box<dyn Error>>
[src]
&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]
&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]
Alias for remove_property
pub fn remove_attribute_ns(
&mut self,
name: &str,
ns: &str
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
name: &str,
ns: &str
) -> Result<(), Box<dyn Error>>
Alias for remove_property_ns
pub fn get_properties(&self) -> HashMap<String, String>
[src]
Get a copy of the attributes of this node
pub fn get_attributes(&self) -> HashMap<String, String>
[src]
Alias for get_properties
pub fn get_namespace(&self) -> Option<Namespace>
[src]
Gets the active namespace associated of this node
pub fn get_namespaces(&self, doc: &Document) -> Vec<Namespace>
[src]
Gets a list of namespaces associated with this node
pub fn get_namespace_declarations(&self) -> Vec<Namespace>
[src]
Get a list of namespaces declared with this node
pub fn set_namespace(
&mut self,
namespace: &Namespace
) -> Result<(), Box<dyn Error>>
[src]
&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]
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]
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]
Removes the namespaces of this Node
and it’s children!
pub fn get_class_names(&self) -> HashSet<String>
[src]
Get a set of class names from this node’s attributes
pub fn add_child(&mut self, child: &mut Node) -> Result<(), String>
[src]
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]
&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]
&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]
Append text to this Node
pub fn unlink_node(&mut self)
[src]
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]
Alias for unlink_node
pub fn unbind_node(&mut self)
[src]
Alias for unlink_node
pub fn unbind(&mut self)
[src]
Alias for unlink_node
pub fn is_unlinked(&self) -> bool
[src]
Checks if node is marked as unlinked
pub fn findnodes(&self, xpath: &str) -> Result<Vec<Node>, ()>
[src]
find nodes via xpath, at a specified node or the document root
pub fn replace_child_node(
&mut self,
new: Node,
old: Node
) -> Result<Node, Box<dyn Error>>
[src]
&mut self,
new: Node,
old: Node
) -> Result<Node, Box<dyn Error>>
replace a self
’s old
child node with a new
node in the same position
borrowed from Perl’s XML::LibXML
Trait Implementations
impl Clone for Node
[src]
impl Debug for Node
[src]
impl Eq for Node
[src]
impl Hash for Node
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
Generates a hash value from the node_ptr
value.
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Node> for Node
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Node
impl !Send for Node
impl !Sync for Node
impl Unpin for Node
impl !UnwindSafe for Node
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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>,