Struct libxml::tree::Node
[−]
[src]
pub struct Node { pub node_ptr: *mut c_void, }
An xml node
Fields
node_ptr: *mut c_void
libxml's xmlNodePtr
Methods
impl Node
[src]
fn new(name: &str, ns: Option<Namespace>, doc: &Document) -> Result<Self, ()>
Create a new node, bound to a given document.
fn new_text(content: &str, doc: &Document) -> Result<Self, ()>
Create a new text node, bound to a given document
fn mock() -> Self
Create a mock node, used for a placeholder argument
fn to_hashable(&self) -> usize
For some reason libc::c_void
isn't hashable and cannot be made hashable
fn get_next_sibling(&self) -> Option<Node>
Returns the next sibling if it exists
fn get_prev_sibling(&self) -> Option<Node>
Returns the previous sibling if it exists
fn get_first_child(&self) -> Option<Node>
Returns the first child if it exists
fn get_last_child(&self) -> Option<Node>
Returns the last child if it exists
fn get_child_nodes(&self) -> Vec<Node>
Returns all child nodes of the given node as a vector
fn get_child_elements(&self) -> Vec<Node>
Returns all child elements of the given node as a vector
fn get_parent(&self) -> Option<Node>
Returns the parent if it exists
fn get_type(&self) -> Option<NodeType>
Get the node type
fn add_prev_sibling(&self, new_sibling: Node) -> Option<Node>
Add a previous sibling
fn add_next_sibling(&self, new_sibling: Node) -> Option<Node>
Add a next sibling
fn is_text_node(&self) -> bool
Returns true iff it is a text node
fn get_name(&self) -> String
Returns the name of the node (empty string if name pointer is NULL
)
fn get_content(&self) -> String
Returns the content of the node
(empty string if content pointer is NULL
)
fn set_content(&mut self, content: &str)
Sets the text content of this Node
fn get_property(&self, name: &str) -> Option<String>
Returns the value of property name
fn get_property_ns(&self, name: &str, ns: &str) -> Option<String>
Returns the value of property name
in namespace ns
fn get_property_node(&self, name: &str) -> Option<Node>
Return an attribute as a Node
struct of type AttributeNode
fn set_property(&mut self, name: &str, value: &str)
Sets the value of property name
to value
fn set_property_ns(&mut self, name: &str, value: &str, ns: Namespace)
Sets a namespaced attribute
fn remove_property(&mut self, name: &str)
Removes the property of given name
fn get_attribute(&self, name: &str) -> Option<String>
Alias for get_property
fn get_attribute_ns(&self, name: &str, ns: &str) -> Option<String>
Alias for get_property_ns
fn get_attribute_node(&self, name: &str) -> Option<Node>
Alias for get_property_node
fn set_attribute(&mut self, name: &str, value: &str)
Alias for set_property
fn set_attribute_ns(&mut self, name: &str, value: &str, ns: Namespace)
Alias for set_property_ns
fn remove_attribute(&mut self, name: &str)
Alias for remove_property
fn get_properties(&self) -> HashMap<String, String>
Get a copy of the attributes of this node
fn get_attributes(&self) -> HashMap<String, String>
Alias for get_properties
fn get_namespace(&self) -> Option<Namespace>
Gets the active namespace associated of this node
fn get_namespaces(&self, doc: &Document) -> Vec<Namespace>
Gets a list of namespaces associated with this node
fn get_namespace_declarations(&self) -> Vec<Namespace>
Get a list of namespaces declared with this node
fn set_namespace(&mut self, namespace: Namespace)
Sets a Namespace
for the node
fn lookup_namespace_prefix(&self, href: &str) -> Option<String>
Looks up the prefix of a namespace from its URI, basedo around a given Node
fn lookup_namespace_uri(&self, prefix: &str) -> Option<String>
Looks up the uri of a namespace from its prefix, basedo around a given Node
fn get_class_names(&self) -> HashSet<String>
Get a set of class names from this node's attributes
fn add_child(&mut self, child: Node) -> Result<Node, ()>
Creates a new Node
as child to the self Node
fn new_child(&mut self, ns: Option<Namespace>, name: &str) -> Result<Node, ()>
Creates a new Node
as child to the self Node
fn add_text_child(
&mut self,
ns: Option<Namespace>,
name: &str,
content: &str
) -> Result<Node, ()>
&mut self,
ns: Option<Namespace>,
name: &str,
content: &str
) -> Result<Node, ()>
Adds a new text child, to this Node
fn append_text(&mut self, content: &str) -> Result<(), ()>
Append text to this Node
Trait Implementations
impl Clone for Node
[src]
fn clone(&self) -> Node
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Hash for Node
[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
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for Node
[src]
fn eq(&self, other: &Node) -> bool
Two nodes are considered equal, if they point to the same xmlNode.
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl Eq for Node
[src]
impl Drop for Node
[src]
fn drop(&mut self)
Free node if it isn't bound in some document