pub struct HtmlNode { /* private fields */ }
Expand description
An HTML element in a document.
Implementations§
Source§impl HtmlNode
impl HtmlNode
Sourcepub fn find_all(&self, selector: &str) -> Result<Vec<HtmlNode>>
pub fn find_all(&self, selector: &str) -> Result<Vec<HtmlNode>>
Find all elements matching a CSS selector.
selector
- The CSS selector to query for.
Sourcepub fn find_all_xpath(&self, xpath: &str) -> Result<Vec<XPathResult>>
pub fn find_all_xpath(&self, xpath: &str) -> Result<Vec<XPathResult>>
Find all elements matching an XPath expression.
xpath
- The XPath expression to query for.
Sourcepub fn find(&self, selector: &str) -> Result<Option<HtmlNode>>
pub fn find(&self, selector: &str) -> Result<Option<HtmlNode>>
Find the first element matching a CSS selector.
selector
- The CSS selector to query for.
Sourcepub fn find_xpath(&self, xpath: &str) -> Result<Option<XPathResult>>
pub fn find_xpath(&self, xpath: &str) -> Result<Option<XPathResult>>
Find the first element matching an XPath expression.
xpath
- The XPath expression to query for.
Sourcepub fn find_nth(&self, selector: &str, n: usize) -> Result<Option<HtmlNode>>
pub fn find_nth(&self, selector: &str, n: usize) -> Result<Option<HtmlNode>>
Find the nth element matching a CSS selector.
selector
- The CSS selector to query for.n
- The index of the element to get.
Sourcepub fn find_nth_xpath(
&self,
xpath: &str,
n: usize,
) -> Result<Option<XPathResult>>
pub fn find_nth_xpath( &self, xpath: &str, n: usize, ) -> Result<Option<XPathResult>>
Find the nth element matching an XPath expression.
xpath
- The XPath expression to query for.n
- The index of the element to get.
Sourcepub fn get_attribute(&self, name: &str) -> Option<&str>
pub fn get_attribute(&self, name: &str) -> Option<&str>
Get the attribute of the node with the specified name.
name
- The name of the attribute to get.
Sourcepub fn inner_text(&self) -> String
pub fn inner_text(&self) -> String
Get the inner text of the node.
Sourcepub fn inner_html(&self) -> String
pub fn inner_html(&self) -> String
Get the inner HTML of the node.
Sourcepub fn outer_html(&self) -> String
pub fn outer_html(&self) -> String
Get the outer HTML of the node.
Trait Implementations§
impl Send for HtmlNode
impl Sync for HtmlNode
Auto Trait Implementations§
impl Freeze for HtmlNode
impl !RefUnwindSafe for HtmlNode
impl Unpin for HtmlNode
impl !UnwindSafe for HtmlNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more