pub struct MicrodataExtractor;Expand description
Extracts Schema.org structured data from HTML Microdata attributes.
§Examples
use schemaorg_rs::extraction::{Extractor, MicrodataExtractor};
let html = r#"<html><body>
<div itemscope itemtype="https://schema.org/Product">
<span itemprop="name">Widget</span>
</div>
</body></html>"#;
let output = MicrodataExtractor.extract(html).unwrap();
assert_eq!(output.nodes[0].types, vec!["Product"]);Implementations§
Source§impl MicrodataExtractor
impl MicrodataExtractor
Sourcepub fn extract_from_document(
&self,
document: &Html,
) -> Result<ExtractionOutput, ExtractionError>
pub fn extract_from_document( &self, document: &Html, ) -> Result<ExtractionOutput, ExtractionError>
Extracts from an already-parsed document.
§Errors
Returns ExtractionError if a fatal error prevents extraction.
Most issues are captured as warnings in the returned output.
§Panics
Panics if the internal CSS selector constant fails to parse. This is a compile-time-verified string and will never fail.
Trait Implementations§
Source§impl Extractor for MicrodataExtractor
impl Extractor for MicrodataExtractor
Source§fn extract(&self, html: &str) -> Result<ExtractionOutput, ExtractionError>
fn extract(&self, html: &str) -> Result<ExtractionOutput, ExtractionError>
Extracts structured data nodes from an HTML document. Read more
Auto Trait Implementations§
impl Freeze for MicrodataExtractor
impl RefUnwindSafe for MicrodataExtractor
impl Send for MicrodataExtractor
impl Sync for MicrodataExtractor
impl Unpin for MicrodataExtractor
impl UnsafeUnpin for MicrodataExtractor
impl UnwindSafe for MicrodataExtractor
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