An open API service indexing awesome lists of open source software.

https://github.com/simulation-tree/xml

Library for XML serialization
https://github.com/simulation-tree/xml

csharp native xml

Last synced: 5 months ago
JSON representation

Library for XML serialization

Awesome Lists containing this project

README

          

# XML

[![Test](https://github.com/simulation-tree/xml/actions/workflows/test.yml/badge.svg)](https://github.com/simulation-tree/xml/actions/workflows/test.yml)

Library for XML serialization.

### Example

XML is supported through the `XMLNode` type, which can be created from either a byte or a char array.
Each node has a name, content, a list of attributes, and a list of children:
```cs
byte[] xmlData = File.ReadAllBytes("solution.csproj");
using XMLNode project = new(xmlData);
XMLAttribute sdk = project["Sdk"];
sdk.Value = "Simulation.NET.Sdk";
project.TryGetFirst("PropertyGroup", out XMLNode propertyGroup);
project.TryGetFirst("TargetFramework", out XMLNode tfm);
tfm.Content = "net9.0";
File.WriteAllText("solution.csproj", project.ToString());
```