A Simple, Stream-Oriented XML Parser for .NET - NuGet: here
- Have an associated XML Schema Definition (XSD);
- Have classes generated from its XSD file (from
xsd.exe
, for example); - You don't want to create the parsing code by hand, going through
XElement
, dealing with strings and etc., especially for complex XML Schemas.
- It is built over regular
XmlReader
andSystem.Xml
infrastructure, so no "out of the world" code. - It is Multi-Platform:
net45
andnetstandard2.0
- Stream-oriented, Memory friendly (around 120 MB of Total Memory Consumption while running tests with over 4GB XML files with Visual Studio), asynchronous XML Validation and Parsing (using
Stream
andTask
); - Schema Loading, XML Validation and Parsing methods with overloads for Byte Arrays, Files and Streams;
- Parsing by type, with header type support (like those XML Files that have Envelope, Header and Payload schemas, e.g. ISO 20022 XML Messages - this library was initially made for these);
- Async Event-raising for nodes read, errors occurred and when it finishes parsing and validating. Kind of SAX inspired, but it raises POCO-like objects;
- Still a work in progress, but you can find code samples in the SAMPLES folder and a very basic usage example can be found here
- When using .NET Core, you must add a
new XmlUrlResolver()
to yourXmlSchemaSet.XmlResolver
property (reference here) or do this.
- It has only one dependency, for better testability, which is System.IO.Abstractions;
- The idea is not to "hog" your
ThreadPool
: It will set theTaskScheduler
toEnvironment.ProcessorCount * 2
by default. Reference from here. - It is modular: Even though the defaults work OK, if you fancy something different, the object constructors from the library get Interfaces for almost everything, so you can replace even the
EventRiser
implementation if you would like.
- It is my first "real" opensource project, so bear with me :). Suggestions and contributions are welcome.
- It is not yet a fully tested solution (you can help to improve that), but it is good enough for what I meant and the current tests cover quite complex scenarios out-of-the-box
- To contribute, clone it, create a branch, do your stuff (with tests, please :)) and submit a pull request.