Exemple #1
0
#pragma warning restore 0809
#endif

        /// <summary>
        /// Swap the to and from, set the type to result.
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public IQ GetResponse(XmlDocument doc)
        {
            IQ resp = new IQ(doc);

            resp.From = this.To;
            resp.To   = this.From;
            resp.ID   = this.ID;
            resp.Type = IQType.result;

            XmlElement q = this.Query;

            if (q != null)
            {
                if (q is Element)
                {
                    resp.AppendChild((XmlElement)((Element)q).CloneNode(true, doc));
                }
                else
                {
                    resp.AppendChild(doc.ImportNode(q, true));
                }
            }

            this.Handled = true;
            return(resp);
        }