Beispiel #1
0
        public override void WriteStartElement(string prefix, string localName, string ns)
        {
            Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);

            _elementScope.Push((byte)_currentElementProperties);

            if (ns.Length == 0)
            {
                Debug.Assert(prefix.Length == 0);

                if (_trackTextContent && _inTextContent)
                {
                    ChangeTextContentMark(false);
                }

                _currentElementProperties = TernaryTreeReadOnly.FindElementProperty(localName);
                base._bufChars[_bufPos++] = (char)'<';
                base.RawText(localName);
                base._attrEndPos = _bufPos;
            }
            else
            {
                // Since the HAS_NS has no impact to the ElementTextBlock behavior,
                // we don't need to push it into the stack.
                _currentElementProperties = ElementProperties.HAS_NS;
                base.WriteStartElement(prefix, localName, ns);
            }
        }
Beispiel #2
0
        public override void WriteStartElement(string prefix, string localName, string ns)
        {
            Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);

            if (_trackTextContent && _inTextContent)
            {
                ChangeTextContentMark(false);
            }

            base._elementScope.Push((byte)base._currentElementProperties);

            if (ns.Length == 0)
            {
                Debug.Assert(prefix.Length == 0);

                base._currentElementProperties = TernaryTreeReadOnly.FindElementProperty(localName);

                if (_endBlockPos == base._bufPos && (base._currentElementProperties & ElementProperties.BLOCK_WS) != 0)
                {
                    WriteIndent();
                }
                _indentLevel++;

                base._bufChars[_bufPos++] = (char)'<';
            }
            else
            {
                base._currentElementProperties = ElementProperties.HAS_NS | ElementProperties.BLOCK_WS;

                if (_endBlockPos == base._bufPos)
                {
                    WriteIndent();
                }
                _indentLevel++;

                base._bufChars[base._bufPos++] = (char)'<';
                if (prefix.Length != 0)
                {
                    base.RawText(prefix);
                    base._bufChars[base._bufPos++] = (char)':';
                }
            }
            base.RawText(localName);
            base._attrEndPos = _bufPos;
        }