I'm writing an ASP.NET Core 7 app and my project now requires me to process an XML file version 1.1.
After searching for a while, I've seen that there is no support from the standard Microsoft libraries, as they only seem to support XML version 1.0.
The alternative, which is to use a third party library, they all seem to be paid solutions.
Is there any free solution (which preferably doesn't require any third party libraries) for being able read an XML version 1.1 in C# (or other)? How can I achieve this?
My sample XML
<?xml version="1.1" encoding="UTF-8"?>
<sample>
<element>Contents of element 1</element>
<element>Contents of element 2</element>
<element>Contents of element 3</element>
</sample>
A fragment of my code to load the XML
XmlReaderSettings settings = new XmlReaderSettings();
// Create an instance of XmlReader to read the XML
XmlReader reader = XmlReader.Create(@"PATHTOMYXML", settings);
// Read the XML line by line
while (reader.Read()) {//This is the line that fails saying that it doesn't recognize the version 1.1
// process the XML
}
// close XmlReader object
reader.Close();
Please, note that changing the version in the XML from 1.1 to 1.0 is not a suitable solution since it contains things from version 1.1.
The two features that appear in my XSD that are from version 1.1 are "assert" and "xSign" These two elements then allow me to check for a condition in the XML (assert) or being able to send a signature in the XML (xSign). Also I need the additional unicode support.
Thanks in advance
As much I don like the answer I'm giving, because is not what was asked. Fact is, there's no solution in the constraints presented. Don't know what what any paid/free 3rd party promises but please stay away from dotnet xml version 1.1. 1.1 is not supported in dotnet (any framework).
There's still a solution that I used in couple of similar situations, and maybe it can be used here, it is dotnet who has to read xml version 1.1 no matter what, it is free (not really, nothing is free in this world but is not a tool you have to pay for something that I doubt will work) plus couple of peanuts for the hosting, so, here's my take.
Finally, I had to give it a separate answer instead of an comment because it can be a solution for your problem.