コード例 #1
0
        protected virtual void WriteElement(HtmlElementRule parent, XmlElement element)
        {
            HtmlElementResult result = ConvertElement(parent, element);

            if (result == null)
            {
                return;
            }

            WriteStartElement(result.Rule, result.Element);
            WriteElementContents(result.Rule, result.Element);
            WriteEndElement(result.Rule, result.Element);
        }
コード例 #2
0
        public override void Execute()
        {
            XmlElement        element = CreateContainer();
            HtmlElementResult result  = ConvertElement(_container, element);

            if (result == null)
            {
                return;
            }

            HtmlElementRule rule = result.Rule;

            WriteStartElement(rule, result.Element);

            if (_renderMode == HtmlElementRenderMode.StartTag)
            {
                _contents.Append('>');
                return;
            }

            WriteElementContents(rule, result.Element);

            if (_renderMode == HtmlElementRenderMode.EndTag)
            {
                _contents.Length = 0;

                HtmlElementOptions options = rule.Options;
                if ((rule.Options & HtmlElementOptions.SelfClosing) ==
                    HtmlElementOptions.SelfClosing)
                {
                    rule.Options = (HtmlElementOptions)((byte)rule.Options - 0x04);
                }

                WriteEndElement(rule, result.Element);
                rule.Options = options;

                if (_contents.Length > 0 && _contents[0] == '>')
                {
                    _contents.Remove(0, 1);
                }
            }
            else
            {
                WriteEndElement(rule, result.Element);
            }
        }