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
- Host: GitHub
- URL: https://github.com/simulation-tree/xml
- Owner: simulation-tree
- Created: 2025-07-19T19:46:13.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-09-24T03:03:25.000Z (9 months ago)
- Last Synced: 2025-09-24T05:18:40.564Z (9 months ago)
- Topics: csharp, native, xml
- Language: C#
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# XML
[](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());
```