Exemplo n.º 1
0
        /// <summary>
        /// Creates a System.Xml.XmlEntityReference node.
        /// </summary>
        /// <param name="name">The name of the entity reference</param>
        public override void WriteEntityRef(string name)
        {
            if (state == WriteState.Element)
            {
                state = WriteState.Content;
            }
            XmlNode n = current;

            if (state == WriteState.Attribute)
            {
                n = ca;
            }
            else if (state != WriteState.Content)
            {
                throw new InvalidOperationException("Invalid state '" + WriteState.ToString() + "' for entity reference");
            }
            n.AppendChild(owner.CreateEntityReference(name));
        }
Exemplo n.º 2
0
        public override void WriteString(string text)
        {
            switch (WriteState)
            {
            case WriteState.Attribute:
                m_writer.PushState(FormatterState.AttributeBody);
                break;

            case WriteState.Element:
                m_writer.PushState(FormatterState.ElementBody);
                break;

            case WriteState.Content:
                m_writer.PushState(FormatterState.Text);
                break;

            default:
                Debug.Fail("Unexpected WriteState in WriteString(): " + WriteState.ToString());
                break;
            }
            base.WriteString(text);
            m_writer.ClearState();
        }