public IXmlResult ParseIATIXML(string url)
{
IXmlResult xmlResult;
var serializer = new XmlSerializer(typeof(XmlResultv1), new XmlRootAttribute("result"));
// Create an XmlNamespaceManager to resolve namespaces.
NameTable nameTable = new NameTable();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(nameTable);
nsmgr.AddNamespace("iati-extra", "");
// Create an XmlParserContext. The XmlParserContext contains all the information
// required to parse the XML fragment, including the entity information and the
// XmlNamespaceManager to use for namespace resolution.
XmlParserContext xmlParserContext = new XmlParserContext(nameTable, nsmgr, null, XmlSpace.None);
// Create the reader.
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings();
xmlReaderSettings.NameTable = nameTable;
using (var Reader = XmlReader.Create(url, xmlReaderSettings, xmlParserContext))
{
xmlResult = (XmlResultv1)serializer.Deserialize(Reader);
}
return xmlResult;
}
}