![]() |
VOOZH | about |
dotnet add package U8XmlParser --version 1.6.1
NuGet\Install-Package U8XmlParser -Version 1.6.1
<PackageReference Include="U8XmlParser" Version="1.6.1" />
<PackageVersion Include="U8XmlParser" Version="1.6.1" />Directory.Packages.props
<PackageReference Include="U8XmlParser" />Project file
paket add U8XmlParser --version 1.6.1
#r "nuget: U8XmlParser, 1.6.1"
#:package U8XmlParser@1.6.1
#addin nuget:?package=U8XmlParser&version=1.6.1Install as a Cake Addin
#tool nuget:?package=U8XmlParser&version=1.6.1Install as a Cake Tool
👁 GitHub license
👁 nuget
👁 openupm
👁 Build and Test
High performance, thread-safe and IL2CPP-safe C# xml parser.
U8XmlParser is faster than any other xml libraries. (See the following benchmark for more info)
.net standard2.0, 2.1, .net framework4.8, .net core3.1, .net5, .net6 are supported.
Install from Nuget package
$ dotnet add package U8XmlParser
Install the package from OpenUPM. See OpenUPM for details.
$ openupm add com.ikorin24.u8xmlparser
Or install the package from UPM by git URL.
git URL: (https://github.com/ikorin24/U8XmlParser.git?path=src/U8XmlParserUnity/Assets/Plugins#v1.6.1)
Add the following libraries built for .net standard2.0 to your project. You can get them at the release page.
It requires dotnet cli tools. (or Visual Studio)
$ git clone https://github.com/ikorin24/U8XmlParser.git
$ cd U8XmlParser
$ dotnet src/U8XmlParser/U8XmlParser.csproj -c Release
/* ------- your_file.xml ----------
<?xml version="1.0" encoding="UTF-8"?>
<SomeData>
<Data aa="20">bbb</Data>
<Data aa="30">ccc</Data>
</SomeData>
----------------------------------- */
// using System.IO;
// using U8Xml;
using (XmlObject xml = XmlParser.ParseFile("your_file.xml"))
{
XmlNode root = xml.Root;
string rootName = root.Name.ToString(); // "SomeData"
// node
XmlNode child = root.Children.First();
string childName = child.Name.ToString(); // "Data"
string innerText = child.InnerText.ToString(); // "bbb"
// attribute
XmlAttribute attr = child.Attributes.First();
string attrName = attr.Name.ToString(); // "aa"
int attrValue = attr.Value.ToInt32(); // 20
// children nodes enumeration
foreach(XmlNode node in root.Children)
{
// do something
}
}
// *** DO NOT use any object from the parser. ***
// XmlObject, XmlNode, RawString, etc... are no longer accessible here.
// Their all memories are released when XmlObject.Dispose() called !!
// They must be evaluated and converted to string, int, and so on.
Some xml has DTD; Document Type Declaration, and it can contain Entity Declaration. Entity defines alias of string in the xml. (For example, 'lt' is defined as alias of '<' by default. We have to resolve it when appears < in xml.)
/* ------- your_file.xml ----------
<?xml version="1.0" encoding="UTF-8"?>
<SomeData>
<foo>
</SomeData>
----------------------------------- */
// using System.IO;
// using U8Xml;
using (XmlObject xml = XmlParser.ParseFile("your_file.xml"))
{
RawString innerText = xml.Root.InnerText; // "<foo>"
XmlEntityTable entities = xml.EntityTable;
string resolvedText = entities.ResolveToString(innerText); // "<foo>"
}
$ cd src/Benchmark
$ dotnet run -c Release -f net6.0
Benchmarked by BenchmarkDotNet.
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.19042.1348 (20H2/October2020Update)
Intel Core i7-10700 CPU 2.90GHz, 1 CPU, 16 logical and 8 physical cores
.NET SDK=6.0.100
[Host] : .NET 6.0.0 (6.0.21.52210), X64 RyuJIT
Job-BZPFMV : .NET 6.0.0 (6.0.21.52210), X64 RyuJIT
Jit=RyuJit Platform=X64 IterationCount=100
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| 'U8Xml.XmlParser (my lib)' | 20.45 ms | 0.053 ms | 0.150 ms | 1.00 | 0.00 | - | - | - | 90 B |
| System.Xml.Linq.XDocument | 124.51 ms | 0.863 ms | 2.543 ms | 6.10 | 0.13 | 7200.0000 | 4000.0000 | 1200.0000 | 51,899,029 B |
| System.Xml.XmlDocument | 172.12 ms | 0.842 ms | 2.415 ms | 8.42 | 0.15 | 10000.0000 | 5333.3333 | 1666.6667 | 76,710,869 B |
| System.Xml.XmlReader | 26.10 ms | 0.041 ms | 0.115 ms | 1.28 | 0.01 | - | - | - | 132,726 B |
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.19042.1348 (20H2/October2020Update)
Intel Core i7-10700 CPU 2.90GHz, 1 CPU, 16 logical and 8 physical cores
.NET SDK=6.0.100
[Host] : .NET 6.0.0 (6.0.21.52210), X64 RyuJIT
Job-VXFJEN : .NET 6.0.0 (6.0.21.52210), X64 RyuJIT
Jit=RyuJit Platform=X64 IterationCount=100
| Method | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Allocated |
|---|---|---|---|---|---|---|---|---|
| 'U8Xml.XmlParser (my lib)' | 163.9 μs | 0.22 μs | 0.63 μs | 1.00 | 0.00 | - | - | 64 B |
| System.Xml.Linq.XDocument | 604.8 μs | 0.41 μs | 1.17 μs | 3.69 | 0.02 | 64.4531 | 13.6719 | 546,186 B |
| System.Xml.XmlDocument | 794.1 μs | 0.77 μs | 2.18 μs | 4.84 | 0.02 | 94.7266 | 46.8750 | 796,905 B |
| System.Xml.XmlReader | 271.6 μs | 0.28 μs | 0.81 μs | 1.66 | 0.01 | 3.4180 | - | 29,352 B |
Author: ikorin24, and all contributors.
This repository is licensed under MIT.
See Licenses of other libraries this repository contains from here.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 is compatible. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 is compatible. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 4 NuGet packages that depend on U8XmlParser:
| Package | Downloads |
|---|---|
|
OEmbed
A simple oEmbed consumer library for .NET |
|
|
NiconicoToolkit
ニコニコ動画/生放送の.Net向けサードパーティライブラリです。 - Account (Login with mail/password) - Video (Play, Comment) - Activity (Video History) - Channels (Videos) - Follow (Tag, User, Mylist, Channel, Community) - Likes (Video) - Live (Play, Comment, TimeShift) - Mylist (List videos, Edit MylistGroup) - NicoRepo - Ranking (Video) - Series (List videos) - User - SnapshotSearchV2 (Video) - Search (Video/Mylist/Live) |
|
|
UnsafeGbxConnector
Package Description |
|
|
Heroes.XmlData
Library to parse the Heroes of the Storm CASC storage. |
Showing the top 1 popular GitHub repositories that depend on U8XmlParser:
| Repository | Stars |
|---|---|
|
ingen084/KyoshinEewViewerIngen
Custom client for Kyoshin Monitor
|