public override void WriteStartElement(string prefix, string localName, string ns) { if (_wrapped == null) { // This is the first time WriteStartElement has been called, so create the Xml or Html writer if (ns.Length == 0 && IsHtmlTag(localName)) { CreateWrappedWriter(XmlOutputMethod.Html); } else { CreateWrappedWriter(XmlOutputMethod.Xml); } } _wrapped.WriteStartElement(prefix, localName, ns); }
/// <summary> /// Check well-formedness, possibly output doc-type-decl, and determine whether this element is a /// CData section element. /// </summary> public override void WriteStartElement(string prefix, string localName, string ns) { EndCDataSection(); if (_checkWellFormedDoc) { // Don't allow multiple document elements if (_depth == 0 && _hasDocElem) { throw new XmlException(ResXml.Xml_NoMultipleRoots, string.Empty); } _depth++; _hasDocElem = true; } // Output doc-type declaration immediately before first element is output if (_outputDocType) { _wrapped.WriteDocType( prefix.Length != 0 ? prefix + ":" + localName : localName, _publicId, _systemId, null); _outputDocType = false; } _wrapped.WriteStartElement(prefix, localName, ns); if (_lookupCDataElems != null) { // Determine whether this element is a CData section element _qnameCData.Init(localName, ns); _bitsCData.PushBit(_lookupCDataElems.ContainsKey(_qnameCData)); } }