RJCP.Core.Xml 0.2.1

dotnet add package RJCP.Core.Xml --version 0.2.1
NuGet\Install-Package RJCP.Core.Xml -Version 0.2.1
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="RJCP.Core.Xml" Version="0.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RJCP.Core.Xml --version 0.2.1
#r "nuget: RJCP.Core.Xml, 0.2.1"
#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 RJCP.Core.Xml as a Cake Addin
#addin nuget:?package=RJCP.Core.Xml&version=0.2.1

// Install RJCP.Core.Xml as a Cake Tool
#tool nuget:?package=RJCP.Core.Xml&version=0.2.1

XML

This assembly contains functions which are useful for parsing XML trees.

1. Parsing XML using Tree-Like Lambdas

The XmlTreeReader allows for defining a datastructure, that is similar to the structure of the XML that should be read, to be interpreted, by executing lambda's within the datastructure.

This has the benefit that:

  • No XmlDocument is needed. Convert an XML into your own datastructure while it is being parsed and potentially save memory.
  • Define the structure for reading, that it is easily readable, similar to the structure of the XML file.

Detailed usage is given in the repository XmlTreeReader.md

For example:

Dictionary<string, List<string>> myData = null;

// Describes an XML format that only has a single root node.
XmlTreeReader reader = new XmlTreeReader() {
    Nodes = {
        new XmlTreeNode("root") {
            ProcessElement = (n, e) => { e.UserObject = new Dictionary<string, List<string>>(); },
            Nodes = {
                new XmlTreeNode("item") {
                    ProcessElement = (n, e) => {
                        string name = e.Reader["name"];
                        List<string> newList = new List<string>();
                        ((Dictionary<string, List<string>>)e.UserObject).Add(name, newList);
                        e.UserObject = newList;
                    },
                    Nodes = {
                        new XmlTreeNode("subitem") {
                            ProcessTextElement = (n, e) {
                                ((List<string>)e.UserObject).Add(e.Reader.Value);
                            }
                        }
                    }
                }
            }
            ProcessEndElement = (n, e) => { myData = (List<string>)e.UserObject; },
        }
    }
};

reader.Read(file);

Lambdas are preferred over events, that keeps the code small and concise.

2. Release History

2.1. Version 0.2.1

Bugfixes:

  • XML: Fix possible NullReferenceException on OnProcessUnknownElement (DOTNET-832)

Quality

  • Add README.md reference to NuGet package (DOTNET-814, DOTNET-932)
  • Upgrade from .NET Standard 2.1 to .NET 6.0 (keep .NET 4.0) (DOTNET-833, DOTNET-936, DOTNET-942, DOTNET-945, DOTNET-959, DOTNET-961, DOTNET-962)
  • XmlTreeReader: Rework null constants (DOTNET-942)
  • NET 6.0: Use the argument name as a string (DOTNET-965)

2.2. Version 0.2.0

  • Initial Release
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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 was computed.  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 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. 
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 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 RJCP.Core.Xml:

Package Downloads
RJCP.Diagnostics.Log.Dlt

An AutoSAR DLT v1 Decoder and Encoder.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.1 125 3/9/2024
0.2.0 176 6/9/2023