pub type RefNode = RcRefCell<NodeImpl>;
Expand description
Opaque DOM tree node reference. This is the type used by this implementation as the concrete
type for the NodeRef
associated type in the Node
trait.
This is the common response type for DOM actions and can be cast to specific traits either
by-hand or using the xml_dom::convert
module. Also, note that this type
supportsPartialEq
and so two nodes
can be tested to ensure they are the same.
Aliased Type§
pub struct RefNode { /* private fields */ }
Trait Implementations§
Source§impl Attribute for RefNode
impl Attribute for RefNode
Source§impl CharacterData for RefNode
impl CharacterData for RefNode
Source§fn substring_data(&self, offset: usize, count: usize) -> Result<String>
fn substring_data(&self, offset: usize, count: usize) -> Result<String>
Extracts a range of data from the node. Read more
Source§fn append_data(&mut self, new_data: &str) -> Result<()>
fn append_data(&mut self, new_data: &str) -> Result<()>
Append the string to the end of the character data of the node. Read more
Source§fn insert_data(&mut self, offset: usize, new_data: &str) -> Result<()>
fn insert_data(&mut self, offset: usize, new_data: &str) -> Result<()>
Insert a string at the specified 16-bit unit offset. Read more
Source§fn delete_data(&mut self, offset: usize, count: usize) -> Result<()>
fn delete_data(&mut self, offset: usize, count: usize) -> Result<()>
Remove a range of 16-bit units from the node. Upon success, data and length reflect the change. Read more
Source§fn replace_data(
&mut self,
offset: usize,
count: usize,
replace_data: &str,
) -> Result<()>
fn replace_data( &mut self, offset: usize, count: usize, replace_data: &str, ) -> Result<()>
Replace the characters starting at the specified 16-bit unit offset with the specified string. Read more
Source§fn length(&self) -> usize
fn length(&self) -> usize
The number of 16-bit units that are available through data and the
substringData
method
below. This may have the value zero, i.e., CharacterData
nodes may be empty. Read moreSource§impl Document for RefNode
impl Document for RefNode
Source§fn doc_type(&self) -> Option<RefNode>
fn doc_type(&self) -> Option<RefNode>
The Document Type Declaration (see
DocumentType
) associated with
this document. Read moreSource§fn document_element(&self) -> Option<RefNode>
fn document_element(&self) -> Option<RefNode>
This is a convenience attribute that allows direct access to the child node that is the
root element of the document. Read more
Source§fn implementation(&self) -> &dyn DOMImplementation<NodeRef = RefNode>
fn implementation(&self) -> &dyn DOMImplementation<NodeRef = RefNode>
The DOMImplementation object that handles this document. Read more
Source§fn create_attribute_with(&self, name: &str, value: &str) -> Result<RefNode>
fn create_attribute_with(&self, name: &str, value: &str) -> Result<RefNode>
Implementation defined extension: this is the same as
create_attribute
except that it
also sets the attribute value.Source§fn create_attribute_ns(
&self,
namespace_uri: &str,
qualified_name: &str,
) -> Result<RefNode>
fn create_attribute_ns( &self, namespace_uri: &str, qualified_name: &str, ) -> Result<RefNode>
Creates an attribute of the given qualified name and namespace URI. Read more
Source§fn create_cdata_section(&self, data: &str) -> Result<RefNode>
fn create_cdata_section(&self, data: &str) -> Result<RefNode>
Creates a
CDataSection
node whose value is the specified string. Read moreSource§fn create_document_fragment(&self) -> Result<RefNode>
fn create_document_fragment(&self) -> Result<RefNode>
Creates an empty DocumentFragment object. Read more
Source§fn create_entity_reference(&self, name: &str) -> Result<RefNode>
fn create_entity_reference(&self, name: &str) -> Result<RefNode>
Creates an
EntityReference
object. Read moreSource§fn create_comment(&self, data: &str) -> RefNode
fn create_comment(&self, data: &str) -> RefNode
Source§fn create_element(&self, tag_name: &str) -> Result<RefNode>
fn create_element(&self, tag_name: &str) -> Result<RefNode>
Creates an element of the type specified. Read more
Source§fn create_element_ns(
&self,
namespace_uri: &str,
qualified_name: &str,
) -> Result<RefNode>
fn create_element_ns( &self, namespace_uri: &str, qualified_name: &str, ) -> Result<RefNode>
Creates an element of the given qualified name and namespace URI. Read more
Source§fn create_processing_instruction(
&self,
target: &str,
data: Option<&str>,
) -> Result<RefNode>
fn create_processing_instruction( &self, target: &str, data: Option<&str>, ) -> Result<RefNode>
Creates a
ProcessingInstruction
node given the
specified name and data strings. Read moreSource§fn create_text_node(&self, data: &str) -> RefNode
fn create_text_node(&self, data: &str) -> RefNode
Source§impl DocumentDecl for RefNode
impl DocumentDecl for RefNode
Source§impl DocumentType for RefNode
impl DocumentType for RefNode
Source§fn entities(&self) -> HashMap<Name, Self::NodeRef, RandomState>
fn entities(&self) -> HashMap<Name, Self::NodeRef, RandomState>
A
NamedNodeMap
containing the general entities, both external and internal, declared in
the DTD. Parameter entities are not contained. Duplicates are discarded. For example in: Read moreSource§impl Element for RefNode
impl Element for RefNode
Source§fn get_attribute(&self, name: &str) -> Option<String>
fn get_attribute(&self, name: &str) -> Option<String>
Retrieves an attribute value by name. Read more
Source§fn set_attribute(&mut self, name: &str, value: &str) -> Result<()>
fn set_attribute(&mut self, name: &str, value: &str) -> Result<()>
Adds a new attribute. Read more
Source§fn remove_attribute(&mut self, name: &str) -> Result<()>
fn remove_attribute(&mut self, name: &str) -> Result<()>
Removes an attribute by name. If the removed attribute is known to have a default value, an
attribute immediately appears containing the default value as well as the corresponding
namespace URI, local name, and prefix when applicable. Read more
Source§fn get_attribute_node(&self, name: &str) -> Option<RefNode>
fn get_attribute_node(&self, name: &str) -> Option<RefNode>
Retrieves an attribute node by name. Read more
Source§fn set_attribute_node(&mut self, new_attribute: RefNode) -> Result<RefNode>
fn set_attribute_node(&mut self, new_attribute: RefNode) -> Result<RefNode>
Adds a new attribute node. Read more
Source§fn remove_attribute_node(&mut self, old_attribute: RefNode) -> Result<RefNode>
fn remove_attribute_node(&mut self, old_attribute: RefNode) -> Result<RefNode>
Removes the specified attribute node. Read more
Source§fn get_elements_by_tag_name(&self, tag_name: &str) -> Vec<RefNode> ⓘ
fn get_elements_by_tag_name(&self, tag_name: &str) -> Vec<RefNode> ⓘ
Returns a
NodeList
of all descendant Element
s with a given tag name, in the order in
which they are encountered in a preorder traversal of this Element
tree. Read moreSource§fn get_attribute_ns(
&self,
namespace_uri: &str,
local_name: &str,
) -> Option<String>
fn get_attribute_ns( &self, namespace_uri: &str, local_name: &str, ) -> Option<String>
Retrieves an attribute value by local name and namespace URI. Read more
Source§fn set_attribute_ns(
&mut self,
namespace_uri: &str,
qualified_name: &str,
value: &str,
) -> Result<()>
fn set_attribute_ns( &mut self, namespace_uri: &str, qualified_name: &str, value: &str, ) -> Result<()>
Adds a new attribute. Read more
Source§fn remove_attribute_ns(
&mut self,
namespace_uri: &str,
local_name: &str,
) -> Result<()>
fn remove_attribute_ns( &mut self, namespace_uri: &str, local_name: &str, ) -> Result<()>
Removes an attribute by local name and namespace URI. Read more
Source§fn get_attribute_node_ns(
&self,
namespace_uri: &str,
local_name: &str,
) -> Option<RefNode>
fn get_attribute_node_ns( &self, namespace_uri: &str, local_name: &str, ) -> Option<RefNode>
Retrieves an Attr node by local name and namespace URI. Read more
Source§fn set_attribute_node_ns(&mut self, new_attribute: RefNode) -> Result<RefNode>
fn set_attribute_node_ns(&mut self, new_attribute: RefNode) -> Result<RefNode>
Adds a new attribute. Read more
Source§fn get_elements_by_tag_name_ns(
&self,
namespace_uri: &str,
local_name: &str,
) -> Vec<RefNode> ⓘ
fn get_elements_by_tag_name_ns( &self, namespace_uri: &str, local_name: &str, ) -> Vec<RefNode> ⓘ
Returns a
NodeList
of all the descendant Element
s with a given local name and namespace
URI in the order in which they are encountered in a preorder traversal of this Element tree. Read moreSource§fn has_attribute(&self, name: &str) -> bool
fn has_attribute(&self, name: &str) -> bool
Returns
true
when an attribute with a given name is specified on this element or has a default
value, false
otherwise. Read moreSource§impl Entity for RefNode
impl Entity for RefNode
Source§impl Namespaced for RefNode
impl Namespaced for RefNode
Source§fn contains_mapping(&self, prefix: Option<&str>) -> bool
fn contains_mapping(&self, prefix: Option<&str>) -> bool
Returns
true
if this, and only this, element has a URI mapping for the provided prefix
,
false
otherwise.Source§fn get_namespace(&self, prefix: Option<&str>) -> Option<String>
fn get_namespace(&self, prefix: Option<&str>) -> Option<String>
Returns the namespace URI associated with the provided
prefix
, None
if the prefix is not
mapped to a URI for this, and only this, element.Source§fn resolve_namespace(&self, prefix: Option<&str>) -> Option<String>
fn resolve_namespace(&self, prefix: Option<&str>) -> Option<String>
Returns the namespace URI associated with the provided
prefix
for this element by looking
up the DOM tree through parent_node
links. Returns None
if the prefix is not mapped to a
URI on this, or any parent, element.Source§fn contains_mapped_namespace(&self, namespace_uri: &str) -> bool
fn contains_mapped_namespace(&self, namespace_uri: &str) -> bool
Returns
true
if this, and only this, element has a URI mapping for the provided
namespace_uri
, false
otherwise.Source§fn get_prefix(&self, namespace_uri: &str) -> NamespacePrefix
fn get_prefix(&self, namespace_uri: &str) -> NamespacePrefix
Returns the prefix associated with the provided
namespace_uri
, None
if the namespace
URI is not mapped with a prefix for this, and only this, element.Source§fn resolve_prefix(&self, namespace_uri: &str) -> NamespacePrefix
fn resolve_prefix(&self, namespace_uri: &str) -> NamespacePrefix
Returns the prefix associated with the provided
namespace_uri
for this element by looking
up the DOM tree through parent_node
links. Returns None
if the namespace is not mapped
with a prefix for this, or any parent, element.Source§impl Node for RefNode
impl Node for RefNode
Source§type NodeRef = RcRefCell<NodeImpl>
type NodeRef = RcRefCell<NodeImpl>
The opaque reference type that wraps the implementation of a node within the DOM.
Source§fn node_name(&self) -> Name
fn node_name(&self) -> Name
The name of this node, depending on its type; see the table above.
Source§fn node_value(&self) -> Option<String>
fn node_value(&self) -> Option<String>
The value of this node, depending on its type; see the table above. When it is defined to
be
None
, setting it has no effect. Read moreSource§fn set_node_value(&mut self, value: &str) -> Result<()>
fn set_node_value(&mut self, value: &str) -> Result<()>
Set the
value
for the node; see node_value
.Source§fn unset_node_value(&mut self) -> Result<()>
fn unset_node_value(&mut self) -> Result<()>
Source§fn parent_node(&self) -> Option<RefNode>
fn parent_node(&self) -> Option<RefNode>
The parent of this node. All nodes, except
Attr
, Document
, DocumentFragment
,
Entity
, and Notation
may have a parent. However, if a node has just been created and not
yet added to the tree, or if it has been removed from the tree, this is None
.Source§fn child_nodes(&self) -> Vec<RefNode> ⓘ
fn child_nodes(&self) -> Vec<RefNode> ⓘ
A
Vec
that contains all children of this node. If there are no children,
this is a Vec
containing no nodes.Source§fn first_child(&self) -> Option<RefNode>
fn first_child(&self) -> Option<RefNode>
The first child of this node. If there is no such node, this returns
None
.Source§fn last_child(&self) -> Option<RefNode>
fn last_child(&self) -> Option<RefNode>
The last child of this node. If there is no such node, this returns
None
.Source§fn previous_sibling(&self) -> Option<RefNode>
fn previous_sibling(&self) -> Option<RefNode>
The node immediately preceding this node. If there is no such node, this returns
None
.Source§fn next_sibling(&self) -> Option<RefNode>
fn next_sibling(&self) -> Option<RefNode>
The node immediately following this node. If there is no such node, this returns
None
.Source§fn attributes(&self) -> HashMap<Name, RefNode, RandomState>
fn attributes(&self) -> HashMap<Name, RefNode, RandomState>
A
HashMap
containing the attributes of this node (if it is an Element
) or
None
otherwise.Source§fn owner_document(&self) -> Option<RefNode>
fn owner_document(&self) -> Option<RefNode>
The
Document
object associated with this node. This is also the Document
object used to create new nodes. When this node is a Document
or a DocumentType
which is
not used with any Document
yet, this is None
.Source§fn insert_before(
&mut self,
new_child: RefNode,
ref_child: Option<RefNode>,
) -> Result<RefNode>
fn insert_before( &mut self, new_child: RefNode, ref_child: Option<RefNode>, ) -> Result<RefNode>
Source§fn replace_child(
&mut self,
new_child: RefNode,
old_child: RefNode,
) -> Result<RefNode>
fn replace_child( &mut self, new_child: RefNode, old_child: RefNode, ) -> Result<RefNode>
Replaces the child node
oldChild
with newChild
in the list of children, and returns the
oldChild
node. Read moreSource§fn remove_child(&mut self, old_child: Self::NodeRef) -> Result<Self::NodeRef>
fn remove_child(&mut self, old_child: Self::NodeRef) -> Result<Self::NodeRef>
Removes the child node indicated by oldChild from the list of children, and returns it. Read more
Source§fn append_child(&mut self, new_child: RefNode) -> Result<RefNode>
fn append_child(&mut self, new_child: RefNode) -> Result<RefNode>
Adds the node
newChild
to the end of the list of children of this node. Read moreSource§fn has_child_nodes(&self) -> bool
fn has_child_nodes(&self) -> bool
Returns whether this node has any children. Read more
Source§fn clone_node(&self, deep: bool) -> Option<RefNode>
fn clone_node(&self, deep: bool) -> Option<RefNode>
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. Read more
Source§fn normalize(&mut self)
fn normalize(&mut self)
Puts all
Text
nodes in the full depth of the sub-tree underneath this
Node
, including attribute nodes, into a “normal” form where only structure (e.g.,
elements, comments, processing instructions, CDATA sections, and entity references)
separates Text
nodes, i.e., there are neither adjacent Text
nodes nor empty Text
nodes. Read moreSource§fn is_supported(&self, feature: &str, version: &str) -> bool
fn is_supported(&self, feature: &str, version: &str) -> bool
Tests whether the DOM implementation implements a specific feature and that feature is
supported by this node. Read more
Source§fn has_attributes(&self) -> bool
fn has_attributes(&self) -> bool
Returns whether this node (if it is an element) has any attributes. Read more
Source§fn namespace_uri(&self) -> Option<String>
fn namespace_uri(&self) -> Option<String>
The namespace URI of this node, or null if it is unspecified. Read more
Source§fn local_name(&self) -> String
fn local_name(&self) -> String
Returns the local part of the qualified name of this node. Read more