Exemplo n.º 1
0
        /// <summary>
        /// Get only the start Tag of the element
        /// </summary>
        /// <remarks>
        /// The start tag of the following xml:
        /// <code>
        /// &lt;message from=&#39;[email protected]&#39; type=&#39;chat&#39;&gt;&lt;body&gt;Hello World&lt;/body&gt;&lt;/message&gt;
        /// </code>
        /// is
        /// <code>
        /// &lt;message from=&#39;[email protected]&#39; type=&#39;chat&#39;&gt;
        /// </code>
        /// </remarks>
        /// <returns></returns>
        public string StartTag()
        {
            var el = new XmppXElement(this);

            el.Nodes().Remove();

            return(el.ToString(false).Replace("/>", ">"));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get only the end tag of the element
        /// </summary>
        /// <remarks>
        /// The end tag of the following xml:
        /// <code>
        /// &lt;message from=&#39;[email protected]&#39; type=&#39;chat&#39;&gt;&lt;body&gt;Hello World&lt;/body&gt;&lt;/message&gt;
        /// </code>
        /// is
        /// <code>
        /// &lt;/message&gt;
        /// </code>
        /// </remarks>
        /// <returns></returns>
        public string EndTag()
        {
            var el = new XmppXElement(this);

            string ret      = el.ToString(false);
            int    spacePos = ret.IndexOf(' ');

            return("</" + ret.Substring(1, spacePos - 1) + ">");
        }