Type Alias RefNode

Source
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

Source§

fn value(&self) -> Option<String>

On retrieval, the value of the attribute is returned as a string. Read more
Source§

fn set_value(&mut self, value: &str) -> Result<()>

Set the value for the node; see value.
Source§

fn unset_value(&mut self) -> Result<()>

Set the value for the node to None; see value.
Source§

fn owner_element(&self) -> Option<Self::NodeRef>

The Element node this attribute is attached to or null if this attribute is not in use.
Source§

fn specified(&self) -> bool

If this attribute was explicitly given a value in the original document, this is true; otherwise, it is false. Read more
Source§

impl CharacterData for RefNode

Source§

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<()>

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<()>

Insert a string at the specified 16-bit unit offset. Read more
Source§

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<()>

Replace the characters starting at the specified 16-bit unit offset with the specified string. Read more
Source§

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 more
Source§

fn data(&self) -> Option<String>

The character data of the node that implements this interface. Read more
Source§

fn set_data(&mut self, data: &str) -> Result<()>

Set the data for the node; see data().
Source§

fn unset_data(&mut self) -> Result<()>

Set the data for the node to None; see data().
Source§

impl Display for RefNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more
Source§

impl Document for RefNode

Source§

fn doc_type(&self) -> Option<RefNode>

The Document Type Declaration (see DocumentType) associated with this document. Read more
Source§

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>

The DOMImplementation object that handles this document. Read more
Source§

fn create_attribute(&self, name: &str) -> Result<RefNode>

Creates an Attribute of the given name. Note that the Attr instance can then be set on an Element using the setAttributeNode method. Read more
Source§

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>

Creates an attribute of the given qualified name and namespace URI. Read more
Source§

fn create_cdata_section(&self, data: &str) -> Result<RefNode>

Creates a CDataSection node whose value is the specified string. Read more
Source§

fn create_document_fragment(&self) -> Result<RefNode>

Creates an empty DocumentFragment object. Read more
Source§

fn create_entity_reference(&self, name: &str) -> Result<RefNode>

Creates an EntityReference object. Read more
Source§

fn create_comment(&self, data: &str) -> RefNode

Creates a Comment node given the specified string. Read more
Source§

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>

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>

Creates a ProcessingInstruction node given the specified name and data strings. Read more
Source§

fn create_text_node(&self, data: &str) -> RefNode

Creates a Text node given the specified string. Read more
Source§

fn get_element_by_id(&self, id: &str) -> Option<RefNode>

Returns the Element whose ID is given by elementId. Read more
Source§

fn get_elements_by_tag_name(&self, tag_name: &str) -> Vec<RefNode>

Returns a NodeList of all the Elements with a given tag name in the order in which they are encountered in a preorder traversal of the Document tree. Read more
Source§

fn get_elements_by_tag_name_ns( &self, namespace_uri: &str, local_name: &str, ) -> Vec<RefNode>

Returns a NodeList of all the Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of the Document tree. Read more
Source§

impl DocumentDecl for RefNode

Source§

fn xml_declaration(&self) -> Option<XmlDecl>

Retrieve the current XML declaration, if set.
Source§

fn set_xml_declaration(&mut self, xml_decl: XmlDecl) -> Result<()>

Set the current XML declaration for this document. Read more
Source§

impl DocumentType for RefNode

Source§

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 more
Source§

fn notations(&self) -> HashMap<Name, Self::NodeRef, RandomState>

A NamedNodeMap containing the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements the Notation interface. Read more
Source§

fn public_id(&self) -> Option<String>

The public identifier of the external subset.
Source§

fn system_id(&self) -> Option<String>

The system identifier of the external subset.
Source§

fn internal_subset(&self) -> Option<String>

The internal subset as a string. Read more
Source§

impl Element for RefNode

Source§

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<()>

Adds a new attribute. Read more
Source§

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>

Retrieves an attribute node by name. Read more
Source§

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>

Removes the specified attribute node. Read more
Source§

fn get_elements_by_tag_name(&self, tag_name: &str) -> Vec<RefNode>

Returns a NodeList of all descendant Elements with a given tag name, in the order in which they are encountered in a preorder traversal of this Element tree. Read more
Source§

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<()>

Adds a new attribute. Read more
Source§

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>

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>

Adds a new attribute. Read more
Source§

fn get_elements_by_tag_name_ns( &self, namespace_uri: &str, local_name: &str, ) -> Vec<RefNode>

Returns a NodeList of all the descendant Elements 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 more
Source§

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 more
Source§

fn has_attribute_ns(&self, namespace_uri: &str, local_name: &str) -> bool

Returns true when an attribute with a given local name and namespace URI is specified on this element or has a default value, false otherwise. Read more
Source§

fn tag_name(&self) -> String

The name of the element. Read more
Source§

impl Entity for RefNode

Source§

fn public_id(&self) -> Option<String>

The public identifier associated with the entity, if specified. Read more
Source§

fn system_id(&self) -> Option<String>

The system identifier associated with the entity, if specified. Read more
Source§

fn notation_name(&self) -> Option<String>

For unparsed entities, the name of the notation for the entity. Read more
Source§

impl Namespaced for RefNode

Source§

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>

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>

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

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

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

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

Source§

type NodeRef = RcRefCell<NodeImpl>

The opaque reference type that wraps the implementation of a node within the DOM.
Source§

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>

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 more
Source§

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<()>

Set the value for the node to None; see node_value.
Source§

fn node_type(&self) -> NodeType

A code representing the type of the underlying object.
Source§

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>

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>

The first child of this node. If there is no such node, this returns None.
Source§

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>

The node immediately preceding this node. If there is no such node, this returns None.
Source§

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>

A HashMap containing the attributes of this node (if it is an Element) or None otherwise.
Source§

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>

Inserts the node newChild before the existing child node refChild. Read more
Source§

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 more
Source§

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>

Adds the node newChild to the end of the list of children of this node. Read more
Source§

fn has_child_nodes(&self) -> bool

Returns whether this node has any children. Read more
Source§

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)

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 more
Source§

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

Returns whether this node (if it is an element) has any attributes. Read more
Source§

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

Returns the local part of the qualified name of this node. Read more
Source§

fn prefix(&self) -> Option<String>

The namespace prefix of this node, or null if it is unspecified. Read more
Source§

impl Notation for RefNode

Source§

fn public_id(&self) -> Option<String>

The public identifier of this notation. Read more
Source§

fn system_id(&self) -> Option<String>

The system identifier of this notation. Read more
Source§

impl ProcessingInstruction for RefNode

Source§

fn length(&self) -> usize

The number of 16-bit units that are available through data.
Source§

fn data(&self) -> Option<String>

The content of this processing instruction. Read more
Source§

fn set_data(&mut self, data: &str) -> Result<()>

Set the data for the node; see data.
Source§

fn unset_data(&mut self) -> Result<()>

Set the data for the node to None; see data.
Source§

fn target(&self) -> String

The target of this processing instruction. Read more
Source§

impl Text for RefNode

Source§

fn split(&mut self, offset: usize) -> Result<RefNode>

Breaks this node into two nodes at the specified offset, keeping both in the tree as siblings. Read more
Source§

impl CDataSection for RefNode

Source§

impl Comment for RefNode

Source§

impl DocumentFragment for RefNode

Source§

impl EntityReference for RefNode