/// <summary> /// Create either the Html or Xml writer and send any cached events to it. /// </summary> private void CreateWrappedWriter(XmlOutputMethod outMethod) { Debug.Assert(_wrapped == null); // Create either the Xml or Html writer _writerSettings.ReadOnly = false; _writerSettings.OutputMethod = outMethod; // If Indent was not set by the user, then default to True for Html if (outMethod == XmlOutputMethod.Html && _writerSettings.IndentInternal == TriState.Unknown) { _writerSettings.Indent = true; } _writerSettings.ReadOnly = true; if (_textWriter != null) { _wrapped = ((XmlWellFormedWriter)XmlWriter.Create(_textWriter, _writerSettings)).RawWriter; } else { _wrapped = ((XmlWellFormedWriter)XmlWriter.Create(_strm, _writerSettings)).RawWriter; } // Send cached events to the new writer _eventCache.EndEvents(); _eventCache.EventsToWriter(_wrapped); // Send OnRemoveWriter event if (_onRemove != null) { (this._onRemove)(_wrapped); } }
public QueryOutputWriter(XmlRawWriter writer, XmlWriterSettings settings) { _wrapped = writer; _systemId = settings.DocTypeSystem; _publicId = settings.DocTypePublic; if (settings.OutputMethod == XmlOutputMethod.Xml) { // Xml output method shouldn't output doc-type-decl if system ID is not defined (even if public ID is) // Only check for well-formed document if output method is xml if (_systemId != null) { _outputDocType = true; _checkWellFormedDoc = true; } // Check for well-formed document if standalone="yes" in an auto-generated xml declaration if (settings.AutoXmlDeclaration && settings.Standalone == XmlStandalone.Yes) { _checkWellFormedDoc = true; } if (settings.CDataSectionElements.Count > 0) { _bitsCData = new BitStack(); _lookupCDataElems = new Dictionary <XmlQualifiedName, int>(); _qnameCData = new XmlQualifiedName(); // Add each element name to the lookup table foreach (XmlQualifiedName name in settings.CDataSectionElements) { _lookupCDataElems[name] = 0; } _bitsCData.PushBit(false); } } else if (settings.OutputMethod == XmlOutputMethod.Html) { // Html output method should output doc-type-decl if system ID or public ID is defined if (_systemId != null || _publicId != null) { _outputDocType = true; } } }
internal void WriteDecl(XmlWriter writer, XmlRawWriter rawWriter) { Debug.Assert(kind == NamespaceKind.NeedToWrite); if (null != rawWriter) { rawWriter.WriteNamespaceDeclaration(prefix, namespaceUri); } else { if (prefix.Length == 0) { writer.WriteStartAttribute(string.Empty, "xmlns", XmlReservedNs.NsXmlNs); } else { writer.WriteStartAttribute("xmlns", prefix, XmlReservedNs.NsXmlNs); } writer.WriteString(namespaceUri); writer.WriteEndAttribute(); } }
internal XmlRawWriterBase64Encoder(XmlRawWriter rawWriter) { _rawWriter = rawWriter; }
internal void WriteFullEndElement(XmlRawWriter rawWriter) { rawWriter.WriteFullEndElement(prefix, localName, namespaceUri); }