// Takes XmlContent and return the body of the tag by type.
        string GetNodeBody(XmlContent content)
        {
            string body;

            if (content.Type == XmlTagType.SelfClosedTag)
            {
                body = content.Body.Substring(1, content.Body.Length - 3);
            }
            else if (content.Type == XmlTagType.CloseTag)
            {
                body = content.Body.Substring(2, content.Body.Length - 3);
            }
            else if (content.Type == XmlTagType.PlaneText)
            {
                body = content.Body;
            }
            else
            {
                body = content.Body.Substring(1, content.Body.Length - 2);
            }

            return(body);
        }
Exemple #2
0
        // Takes XmlContent and creates XmlNode with all properties except Children.
        XmlNode CreateNodeFromContent(XmlContent content)
        {
            XmlNode node = new XmlNode();

            if (content.Type == XmlTagType.PlaneText)
            {
                node.PlaneText = true;
                node.Tag       = "text";
                node.Text      = content.Body;
            }
            else
            {
                node.Tag        = content.Name;
                node.Attributes = content.Attributes;

                if (content.Type == XmlTagType.SelfClosedTag)
                {
                    node.SelfClosing = true;
                }
            }

            return(node);
        }
 public XmlContentException(XmlContent content, string message = "") : base(message)
 {
     Content = content;
 }