The developer of this particular library seems to be MIA. https://github.com/Kamiizumi/NmapXmlParser
To test the issue grab his library (NmapXmlParser) from Nu-Get and make sure you have
using System.Xml.Serialization;
using System.IO;
using Xunit;
The code he gives on the example looks like this
var xmlSerializer = new XmlSerializer(typeof(nmaprun));
var result = default(nmaprun);
using (var xmlStream = new StreamReader("NmapResults.xml"))
{
result = xmlSerializer.Deserialize(xmlStream) as nmaprun;
}
Console.WriteLine(result.args);
This works when getting the elements inside of the nmaprun object. He does not give any other examples so I assumed if I wanted to check the host object i would change all instances of nmaprun in above code to host. And then on the Console line change to an element inside the host object like this
var xmlSerializer = new XmlSerializer(typeof(host));
var result = default(host);
using (var xmlStream = new StreamReader("NmapResults.xml"))
{
result = xmlSerializer.Deserialize(xmlStream) as host;
}
Console.WriteLine(result.reason);
The Intellisense inside of the Console.Writeline wants to autocomplete to the elements so I feel its set up right but I keep getting this error.
System.InvalidOperationException: 'There is an error in XML document (5, 2).' Inner Exception InvalidOperationException: was not expected.
You can use the example XML in his Github if you do not have an Nmap xml output file