/// <summary> /// This should return DataConnection since every query element represents exactly one connection /// In special cases (SPList, Soap) we defer to a subclass to mine more data. /// </summary> /// <param name="queryElement"></param> /// <returns></returns> private static DataConnection ParseDataConnection(XElement queryElement) { XElement dataConnection = queryElement.Element(xsfNamespace + spListConnection); if (dataConnection != null) return SPListConnection.Parse(dataConnection); else if ((dataConnection = queryElement.Element(xsfNamespace + spListConnectionRW)) != null) return SPListConnection.Parse(dataConnection); else if ((dataConnection = queryElement.Element(xsfNamespace + soapConnection)) != null) return SoapConnection.Parse(dataConnection); else if ((dataConnection = queryElement.Element(xsfNamespace + xmlConnection)) != null) return XmlConnection.Parse(dataConnection); else if ((dataConnection = queryElement.Element(xsfNamespace + adoConnection)) != null) return AdoConnection.Parse(dataConnection); // else just grab the type and log that. Nothing else to do here. foreach (XElement x in queryElement.Elements()) { if (dataConnection != null) throw new ArgumentException("More than one adapter found under a query node"); dataConnection = x; } if (dataConnection == null) throw new ArgumentException("No adapter found under query node"); DataConnection dc = new DataConnection(); dc.ConnectionType = dataConnection.Name.LocalName; return dc; }
private static SoapConnection ParseInternal(XElement dataConnection) { SoapConnection sc = new SoapConnection(); XElement op = dataConnection.Element(xsfNamespace + operation); if (op == null) { sc.ServiceUrl = dataConnection.Attribute(wsdlUrlAttribute).Value; sc.ServiceMethod = dataConnection.Attribute(nameAttribute).Value; } else { sc.ServiceUrl = op.Attribute(serviceUrlAttribute).Value; sc.ServiceMethod = op.Attribute(nameAttribute).Value; XElement inp = op.Element(xsfNamespace + input); if (inp != null && sc.ServiceUrl.Equals("")) { sc.ServiceUrl = inp.Attribute(sourceAttribute).Value; sc.ServiceMethod = "?"; } } if (sc.ServiceUrl.Equals("")) { Console.WriteLine(dataConnection.ToString()); } return(sc); }