ServantSoftware.Data.Xml 1.0.0.216

There is a newer version of this package available.
See the version list below for details.
dotnet add package ServantSoftware.Data.Xml --version 1.0.0.216
NuGet\Install-Package ServantSoftware.Data.Xml -Version 1.0.0.216
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="ServantSoftware.Data.Xml" Version="1.0.0.216" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ServantSoftware.Data.Xml --version 1.0.0.216
#r "nuget: ServantSoftware.Data.Xml, 1.0.0.216"
#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.
// Install ServantSoftware.Data.Xml as a Cake Addin
#addin nuget:?package=ServantSoftware.Data.Xml&version=1.0.0.216

// Install ServantSoftware.Data.Xml as a Cake Tool
#tool nuget:?package=ServantSoftware.Data.Xml&version=1.0.0.216

XML ADO.NET Data Provider

The XML ADO.NET Data Provider offers a set of classes that facilitate data access to XML files using the ADO.NET framework. It provides CRUD (Create, Read, Update, Delete) operations to interact with XML files as if they were a database.

Features

  • ADO.NET compliant provider for XML files.
  • Support for CRUD operations.
  • Implementation of ADO.NET interfaces for consistency with other data providers.
  • Customizable and extendable to meet specific needs.
  • Comprehensive XML comments to assist with usage.
  • Support for strongly typed XML data via XmlReader and XmlWriter. Learn more about strongly typed data and Converting to CLR types. If an XML file doesn't have an accompanying XSD, all columns will default to type System.String.

Getting Started

Prerequisites

  • .NET 7.0 or later.
  • An IDE that supports .NET development, such as Visual Studio.

Installation

You can install the XML ADO.NET Data Provider from the NuGet package manager or by using the following command in your terminal:

dotnet add package ServantSoftware.Data.Xml

Usage

To use the XML ADO.NET Data Provider, you will need to create an XmlConnection instance, then create an XmlCommand instance, and execute it. Here's an example:

using System.Data.XmlClient;

var connectionString = new FileConnectionString() { DataSource = "path/to/your/file.xml" };
using var connection = new XmlConnection(connectionString);
connection.Open();

var commandText = "SELECT * FROM your_element";
using var command = new XmlCommand(commandText, connection);
using var reader = command.ExecuteReader();

while (reader.Read())
{
    // Process data
}

connection.Close();

Connection String

The connection string is mainly used to determine the data source for the provider, which is the path to the XML file.

For example, if your XML structure is:

<database>
    <employees>
        <employee>
            <name>Joe</name>
            <email>Joe@gmail.com</email>
            <salary>56000</salary>
            <married>true</married>
        </employee>
        <employee>
            <name>Bob</name>
            <email>bob32@gmail.com</email>
            <salary>95000</salary>
        </employee>
    </employees>
    <locations>
        <location>
            <city>Houston</city>
            <state>Texas</state>
            <zip>77846</zip>
        </location>
        <location>
            <city>New Braunfels</city>
            <state>Texas</state>
            <zip>78132</zip>
        </location>
    </locations>
</database>

You can query specific elements and attributes, and the hierarchy of XML is treated similarly to tables in relational databases.

XML data has the ability to be strongly typed. XmlReader/XmlWriter supports strongly typed data. (Also see Converting to CLR types). If the XML file does not have an accompanying XSD file, then all columns should just be of type System.String.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.

License

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

Acknowledgments

  • Thanks to the .NET Foundation for the ADO.NET framework.
  • Thanks to everyone who has contributed to this project.
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ServantSoftware.Data.Xml:

Package Downloads
ServantSoftware.EFCore.Xml

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0.259 90 6/8/2024
1.0.0.258 161 4/17/2024
1.0.0.257 104 4/17/2024
1.0.0.256 95 4/17/2024
1.0.0.254 97 4/15/2024
1.0.0.253 83 4/15/2024
1.0.0.252 88 4/14/2024
1.0.0.251 78 4/14/2024
1.0.0.250 79 4/13/2024
1.0.0.249 72 4/13/2024
1.0.0.248 82 4/11/2024
1.0.0.247 81 4/11/2024
1.0.0.246 84 4/1/2024
1.0.0.245 79 4/1/2024
1.0.0.242 101 3/27/2024
1.0.0.241 95 3/27/2024
1.0.0.240 79 3/27/2024
1.0.0.239 72 3/27/2024
1.0.0.238 116 3/16/2024
1.0.0.237 85 3/16/2024
1.0.0.236 140 2/14/2024
1.0.0.235 167 12/20/2023
1.0.0.233 196 10/23/2023
1.0.0.232 101 10/23/2023
1.0.0.231 95 10/23/2023
1.0.0.230 97 10/23/2023
1.0.0.229 103 10/23/2023
1.0.0.228 95 10/22/2023
1.0.0.227 98 10/22/2023
1.0.0.226 113 10/22/2023
1.0.0.225 111 10/22/2023
1.0.0.224 90 10/22/2023
1.0.0.223 102 10/22/2023
1.0.0.222 106 10/22/2023
1.0.0.221 120 10/22/2023
1.0.0.220 104 10/21/2023
1.0.0.219 101 10/21/2023
1.0.0.218 104 10/21/2023
1.0.0.217 98 10/21/2023
1.0.0.216 102 10/21/2023
1.0.0.215 86 10/21/2023
1.0.0.214 102 10/21/2023
1.0.0.213 103 10/21/2023
1.0.0.212 92 10/21/2023
1.0.0.211 100 10/20/2023
1.0.0.210 95 10/20/2023
1.0.0.209 92 10/20/2023
1.0.0.208 98 10/20/2023
1.0.0.207 98 10/20/2023
1.0.0.206 112 10/20/2023
1.0.0.205 88 10/20/2023
1.0.0.204 84 10/19/2023
1.0.0.203 94 10/17/2023
1.0.0.202 108 10/10/2023
1.0.0.201 124 10/7/2023
1.0.0.200 112 10/3/2023
1.0.0.199 106 10/2/2023
1.0.0.198 100 10/2/2023
1.0.0.195 98 9/27/2023
1.0.0.194 112 9/27/2023
1.0.0.193 112 9/27/2023
1.0.0.192 111 9/27/2023
1.0.0.191 119 9/26/2023
1.0.0.189 101 9/22/2023
1.0.0.188 104 9/22/2023
1.0.0.187 111 9/22/2023
1.0.0.186 96 9/19/2023
1.0.0.185 102 9/18/2023
1.0.0.184 109 9/17/2023
1.0.0.183 101 9/17/2023
1.0.0.182 104 9/16/2023
1.0.0.181 120 9/15/2023
1.0.0.179 133 9/14/2023
1.0.0.178 117 9/14/2023
1.0.0.176 118 9/13/2023
1.0.0.175 119 9/9/2023
1.0.0.174 118 9/8/2023
1.0.0.173 130 9/1/2023
1.0.0.172 110 9/1/2023
1.0.0.171 147 8/31/2023
1.0.0.170 125 8/25/2023
1.0.0.169 133 8/24/2023