WebSpark.Slurper 3.2.0

dotnet add package WebSpark.Slurper --version 3.2.0
                    
NuGet\Install-Package WebSpark.Slurper -Version 3.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WebSpark.Slurper" Version="3.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WebSpark.Slurper" Version="3.2.0" />
                    
Directory.Packages.props
<PackageReference Include="WebSpark.Slurper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WebSpark.Slurper --version 3.2.0
                    
#r "nuget: WebSpark.Slurper, 3.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=WebSpark.Slurper&version=3.2.0
                    
Install WebSpark.Slurper as a Cake Addin
#tool nuget:?package=WebSpark.Slurper&version=3.2.0
                    
Install WebSpark.Slurper as a Cake Tool

Slurper

Slurper is a flexible .NET library for data extraction and transformation from XML, JSON, CSV, and HTML sources. It simplifies working with structured data by providing a unified API and dynamic object capabilities.

Features

  • Multiple Data Formats: Extract data from XML, JSON, CSV, and HTML sources
  • Unified API: Consistent interface for all supported formats
  • Dynamic Object Support: Access extracted data using dynamic properties
  • Async Support: All extraction methods have asynchronous versions
  • Dependency Injection: Full integration with .NET DI container
  • Error Handling: Comprehensive exception types for better error handling
  • Logging: Built-in logging support for diagnostics
  • Extensibility: Plugin system for adding custom data extractors
  • Performance Options: Streaming, parallel processing, and caching options

Quick Start

// Create a factory
var factory = new SlurperFactory();

// Get an extractor
var xmlExtractor = factory.CreateXmlExtractor();

// Extract data from a string
string xml = "<book id=\"bk101\"><author>Gambardella, Matthew</author><title>XML Developer Guide</title></book>";
var books = xmlExtractor.Extract(xml);
var book = books.First();

// Access data with dynamic properties
Console.WriteLine($"Author: {book.author}, Title: {book.title}");

// Extract from file or URL
var booksFromFile = xmlExtractor.ExtractFromFile("books.xml");
var booksFromUrl = await xmlExtractor.ExtractFromUrlAsync("https://example.com/books.xml");

Advanced Features

Using Configuration Options

var options = new SlurperOptions
{
    UseStreaming = true,
    EnableParallelProcessing = true,
    EnableCaching = true
};

var result = await extractor.ExtractFromFileAsync("large-data.xml", options);

Dependency Injection

// In Startup.cs or Program.cs
services.AddSlurper();

// In your service class constructor
public MyService(IXmlExtractor xmlExtractor, IJsonExtractor jsonExtractor)
{
    _xmlExtractor = xmlExtractor;
    _jsonExtractor = jsonExtractor;
}

Custom Plugins

// Create and register a plugin
var factory = new SlurperFactory();
var yamlPlugin = new YamlExtractorPlugin();
factory.RegisterPlugin(yamlPlugin);

// Use the plugin
var plugin = factory.GetPluginForSourceType("yaml");
var data = plugin.Extract<dynamic>("yaml-content");

Documentation

For detailed examples and API documentation, see the USAGE.md file.

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

Requirements

  • .NET 9.0 or later
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.2.0 132 5/4/2025
3.1.5 89 5/4/2025
3.1.3 96 5/4/2025
3.1.1 60 5/3/2025
3.1.0 55 5/3/2025