Skip to main content

Module extraction

Module extraction 

Source
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:

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§

ExtractionOutput
Output from a single extractor run.
JsonLdExtractor
Extracts Schema.org structured data from JSON-LD <script> tags.
MicrodataExtractor
Extracts Schema.org structured data from HTML Microdata attributes.
RdfaLiteExtractor
Extracts Schema.org structured data from RDFa Lite 1.1 attributes.

Traits§

Extractor
Trait implemented by each extraction format (JSON-LD, Microdata, RDFa).