Expand description
Structured data extractors for JSON-LD, Microdata, and RDFa Lite.
This module provides the Extractor trait and concrete implementations
for each structured data format:
JsonLdExtractor–<script type="application/ld+json">tagsMicrodataExtractor–itemscope/itempropattributesRdfaLiteExtractor–vocab/typeof/propertyattributes
Each extractor produces an ExtractionOutput containing extracted
SchemaNodes and any non-fatal warnings. For most use cases, prefer
extract_all which runs all extractors
and merges results.
§Examples
use schemaorg_rs::extraction::{Extractor, JsonLdExtractor};
let html = r#"<html><head>
<script type="application/ld+json">{
"@context": "https://schema.org",
"@type": "Product",
"name": "Widget"
}</script>
</head></html>"#;
let output = JsonLdExtractor.extract(html).unwrap();
assert_eq!(output.nodes.len(), 1);Structs§
- Extraction
Output - Output from a single extractor run.
- Json
LdExtractor - Extracts Schema.org structured data from JSON-LD
<script>tags. - Microdata
Extractor - Extracts Schema.org structured data from HTML Microdata attributes.
- Rdfa
Lite Extractor - Extracts Schema.org structured data from
RDFaLite 1.1 attributes.
Traits§
- Extractor
- Trait implemented by each extraction format (JSON-LD, Microdata,
RDFa).