ServantSoftware.Data.Xml
1.0.0.284
See the version list below for details.
dotnet add package ServantSoftware.Data.Xml --version 1.0.0.284
NuGet\Install-Package ServantSoftware.Data.Xml -Version 1.0.0.284
<PackageReference Include="ServantSoftware.Data.Xml" Version="1.0.0.284" />
paket add ServantSoftware.Data.Xml --version 1.0.0.284
#r "nuget: ServantSoftware.Data.Xml, 1.0.0.284"
// Install ServantSoftware.Data.Xml as a Cake Addin #addin nuget:?package=ServantSoftware.Data.Xml&version=1.0.0.284 // Install ServantSoftware.Data.Xml as a Cake Tool #tool nuget:?package=ServantSoftware.Data.Xml&version=1.0.0.284
XML ADO.NET Data Provider
Package Name | Release (NuGet) |
---|---|
ServantSoftware.Data.Xml |
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. The data source can be either a file path to a folder or to an XML file.
Folder As Database
For example, if your XML structure is:
If a path to a folder is provided, then the folder represents the XML database, and each XML file in the folder represents a table. The file name then becomes the table's name. The XML data within each file is treated as a set of records.
For instance, consider an XML file named employees.xml with the following content:
<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>
In the above example, this XML would represent a table named employees with four columns: name, email, salary, and married.
File As Database
If a path to an XML file is provided, then the XML file represents the database. The structure and organization of the XML data will dictate the representation of tables and records. Each major XML element can be seen as a table, and the sub-elements represent the records and fields.
For example:
<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>
The above XML would represent a database containing two tables: employees and locations, each with their respective columns and values.
You can query specific elements and attributes, and the hierarchy of XML is treated similarly to tables in relational databases.
Strongly Typed Data
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. 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. net9.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- ServantSoftware.Data.Common (>= 1.0.0.284)
-
net7.0
- ServantSoftware.Data.Common (>= 1.0.0.284)
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.298 | 70 | 1/8/2025 |
1.0.0.297 | 79 | 1/7/2025 |
1.0.0.296 | 144 | 12/18/2024 |
1.0.0.295 | 97 | 12/18/2024 |
1.0.0.294 | 100 | 12/18/2024 |
1.0.0.293 | 100 | 12/18/2024 |
1.0.0.289 | 99 | 12/17/2024 |
1.0.0.288 | 96 | 12/16/2024 |
1.0.0.287 | 97 | 12/16/2024 |
1.0.0.286 | 102 | 12/14/2024 |
1.0.0.285 | 90 | 12/14/2024 |
1.0.0.284 | 104 | 12/11/2024 |
1.0.0.283 | 89 | 12/11/2024 |
1.0.0.282 | 97 | 12/10/2024 |
1.0.0.281 | 86 | 12/10/2024 |
1.0.0.280 | 92 | 12/10/2024 |
1.0.0.279 | 113 | 11/18/2024 |
1.0.0.278 | 103 | 11/15/2024 |
1.0.0.277 | 101 | 11/15/2024 |
1.0.0.276 | 110 | 11/15/2024 |
1.0.0.275 | 112 | 11/13/2024 |
1.0.0.274 | 105 | 11/13/2024 |
1.0.0.273 | 109 | 11/12/2024 |
1.0.0.272 | 116 | 11/11/2024 |
1.0.0.271 | 109 | 11/5/2024 |
1.0.0.270 | 107 | 11/5/2024 |
1.0.0.269 | 103 | 11/5/2024 |
1.0.0.268 | 106 | 11/1/2024 |
1.0.0.267 | 100 | 11/1/2024 |
1.0.0.266 | 102 | 11/1/2024 |
1.0.0.265 | 103 | 11/1/2024 |
1.0.0.264 | 105 | 11/1/2024 |
1.0.0.263 | 116 | 10/6/2024 |
1.0.0.262 | 102 | 10/6/2024 |
1.0.0.261 | 113 | 10/2/2024 |
1.0.0.260 | 104 | 10/2/2024 |
1.0.0.259 | 157 | 6/8/2024 |
1.0.0.258 | 206 | 4/17/2024 |
1.0.0.257 | 145 | 4/17/2024 |
1.0.0.256 | 131 | 4/17/2024 |
1.0.0.254 | 137 | 4/15/2024 |
1.0.0.253 | 121 | 4/15/2024 |
1.0.0.252 | 131 | 4/14/2024 |
1.0.0.251 | 118 | 4/14/2024 |
1.0.0.250 | 122 | 4/13/2024 |
1.0.0.249 | 117 | 4/13/2024 |
1.0.0.248 | 128 | 4/11/2024 |
1.0.0.247 | 123 | 4/11/2024 |
1.0.0.246 | 121 | 4/1/2024 |
1.0.0.245 | 114 | 4/1/2024 |
1.0.0.242 | 139 | 3/27/2024 |
1.0.0.241 | 141 | 3/27/2024 |
1.0.0.240 | 148 | 3/27/2024 |
1.0.0.239 | 137 | 3/27/2024 |
1.0.0.238 | 152 | 3/16/2024 |
1.0.0.237 | 136 | 3/16/2024 |
1.0.0.236 | 187 | 2/14/2024 |
1.0.0.235 | 206 | 12/20/2023 |
1.0.0.233 | 220 | 10/23/2023 |
1.0.0.232 | 126 | 10/23/2023 |
1.0.0.231 | 124 | 10/23/2023 |
1.0.0.230 | 136 | 10/23/2023 |
1.0.0.229 | 132 | 10/23/2023 |
1.0.0.228 | 138 | 10/22/2023 |
1.0.0.227 | 137 | 10/22/2023 |
1.0.0.226 | 149 | 10/22/2023 |
1.0.0.225 | 149 | 10/22/2023 |
1.0.0.224 | 132 | 10/22/2023 |
1.0.0.223 | 128 | 10/22/2023 |
1.0.0.222 | 132 | 10/22/2023 |
1.0.0.221 | 158 | 10/22/2023 |
1.0.0.220 | 147 | 10/21/2023 |
1.0.0.219 | 142 | 10/21/2023 |
1.0.0.218 | 145 | 10/21/2023 |
1.0.0.217 | 141 | 10/21/2023 |
1.0.0.216 | 147 | 10/21/2023 |
1.0.0.215 | 125 | 10/21/2023 |
1.0.0.214 | 127 | 10/21/2023 |
1.0.0.213 | 141 | 10/21/2023 |
1.0.0.212 | 130 | 10/21/2023 |
1.0.0.211 | 140 | 10/20/2023 |
1.0.0.210 | 136 | 10/20/2023 |
1.0.0.209 | 130 | 10/20/2023 |
1.0.0.208 | 127 | 10/20/2023 |
1.0.0.207 | 135 | 10/20/2023 |
1.0.0.206 | 154 | 10/20/2023 |
1.0.0.205 | 123 | 10/20/2023 |
1.0.0.204 | 123 | 10/19/2023 |
1.0.0.203 | 131 | 10/17/2023 |
1.0.0.202 | 146 | 10/10/2023 |
1.0.0.201 | 167 | 10/7/2023 |
1.0.0.200 | 151 | 10/3/2023 |
1.0.0.199 | 145 | 10/2/2023 |
1.0.0.198 | 137 | 10/2/2023 |
1.0.0.195 | 137 | 9/27/2023 |
1.0.0.194 | 146 | 9/27/2023 |
1.0.0.193 | 151 | 9/27/2023 |
1.0.0.192 | 147 | 9/27/2023 |
1.0.0.191 | 156 | 9/26/2023 |
1.0.0.189 | 144 | 9/22/2023 |
1.0.0.188 | 144 | 9/22/2023 |
1.0.0.187 | 159 | 9/22/2023 |
1.0.0.186 | 132 | 9/19/2023 |
1.0.0.185 | 140 | 9/18/2023 |
1.0.0.184 | 151 | 9/17/2023 |
1.0.0.183 | 138 | 9/17/2023 |
1.0.0.182 | 151 | 9/16/2023 |
1.0.0.181 | 157 | 9/15/2023 |
1.0.0.179 | 173 | 9/14/2023 |
1.0.0.178 | 154 | 9/14/2023 |
1.0.0.176 | 159 | 9/13/2023 |
1.0.0.175 | 158 | 9/9/2023 |
1.0.0.174 | 144 | 9/8/2023 |
1.0.0.173 | 171 | 9/1/2023 |
1.0.0.172 | 152 | 9/1/2023 |
1.0.0.171 | 192 | 8/31/2023 |
1.0.0.170 | 159 | 8/25/2023 |
1.0.0.169 | 169 | 8/24/2023 |