// --------------------------------------------------------------------------------------- // return true if there was an exception returned by the Soap call // --------------------------------------------------------------------------------------- private static bool IsException(XmlDocument xmlDoc, XmlNamespaceManager namespaceManager) { XmlNode SoapException; SoapException = xmlDoc.SelectSingleNode(AbnLookupXpath.LocationSoap(AbnLookupXpath.Path.Exception), namespaceManager); return(!(SoapException == null)); }
// --------------------------------------------------------------------------------------- // Get the name details from the dom // --------------------------------------------------------------------------------------- public static DataTable GetNames(string xml) { DataTable MatchingNames = CreateNewNamesDataTable(); XmlDocument XmlDoc = LoadXml(xml); XmlNamespaceManager NamespaceManager = initialiseNamespace(XmlDoc); try { if (!IsException(XmlDoc, NamespaceManager)) { XmlNodeList Names = XmlDoc.SelectNodes(AbnLookupXpath.LocationSoap(AbnLookupXpath.Path.CommonRoot), NamespaceManager); foreach (System.Xml.XmlNode Name in Names) { DataRow MatchingName = MatchingNames.NewRow(); MatchingName["ABN"] = getNodeValue(Name, AbnLookupXpath.LocationSoap(AbnLookupXpath.Path.AbnValue), NamespaceManager); MatchingName["Entity Name"] = getNodeValue(Name, AbnLookupXpath.LocationSoap(AbnLookupXpath.Path.Name), NamespaceManager); MatchingName["State"] = getNodeValue(Name, AbnLookupXpath.LocationSoap(AbnLookupXpath.Path.State), NamespaceManager); MatchingName["Postcode"] = getNodeValue(Name, AbnLookupXpath.LocationSoap(AbnLookupXpath.Path.Postcode), NamespaceManager); MatchingName["Score"] = getNodeValue(Name, AbnLookupXpath.LocationSoap(AbnLookupXpath.Path.Score), NamespaceManager); MatchingNames.Rows.Add(MatchingName); } } else { throw new System.Exception("Exception from Soap Search"); } } catch { throw; } return(MatchingNames); }