2 //------------------------------------------------------------------------------
3 // <copyright file="TextWriterGenerator.cxx" company="Microsoft">
4 // Copyright (c) Microsoft Corporation. All rights reserved.
6 // <owner current="true" primary="true">Microsoft</owner>
7 //------------------------------------------------------------------------------
9 // WARNING: This file is generated and should not be modified directly. Instead,
10 // modify TextWriterGenerator.cxx and run gen.bat in the same directory.
11 // This batch file will execute the following commands:
13 // cl.exe /C /EP /D _UTF8_TEXT_WRITER TextWriterGenerator.cxx > Utf8TextWriter.cs
14 // cl.exe /C /EP /D _ENCODED_TEXT_WRITER TextWriterGenerator.cxx > EncodedTextWriter.cs
16 // Because these two implementations of TextWriter are so similar, the C++ preprocessor
17 // is used to generate each implementation from one template file, using macros and ifdefs.
32 //using System.Xml.Query;
33 using System.Xml.Schema;
34 using System.Diagnostics;
35 using System.Globalization;
37 namespace System.Xml {
38 // Concrete implementation of XmlRawWriter interface that serializes text events as encoded
39 // text. All other non-text events are ignored. The general-purpose TextEncodedRawTextWriter uses the
40 // Encoder class to output to any encoding. The TextUtf8RawTextWriter class combined the encoding
41 // operation with serialization in order to achieve better performance.
43 internal class TextUtf8RawTextWriter : XmlUtf8RawTextWriter {
51 // Construct an instance of this class that serializes to a Stream interface.
52 public TextUtf8RawTextWriter( Stream stream, XmlWriterSettings settings ) : base( stream, settings ) {
59 // Ignore Xml declaration
60 internal override void WriteXmlDeclaration( XmlStandalone standalone ) {
62 internal override void WriteXmlDeclaration( string xmldecl ) {
66 public override void WriteDocType( string name, string pubid, string sysid, string subset ) {
70 public override void WriteStartElement( string prefix, string localName, string ns ) {
73 internal override void WriteEndElement( string prefix, string localName, string ns ) {
76 internal override void WriteFullEndElement( string prefix, string localName, string ns ) {
79 internal override void StartElementContent() {
83 public override void WriteStartAttribute( string prefix, string localName, string ns ) {
84 base.inAttributeValue = true;
87 public override void WriteEndAttribute() {
88 base.inAttributeValue = false;
91 // Ignore namespace declarations
92 internal override void WriteNamespaceDeclaration( string prefix, string ns ) {
95 internal override bool SupportsNamespaceDeclarationInChunks {
101 // Output content of CDATA sections as plain text without escaping
102 public override void WriteCData( string text ) {
103 base.WriteRaw( text );
107 public override void WriteComment( string text ) {
110 // Ignore processing instructions
111 public override void WriteProcessingInstruction( string name, string text ) {
115 public override void WriteEntityRef( string name ) {
117 public override void WriteCharEntity( char ch ) {
119 public override void WriteSurrogateCharEntity( char lowChar, char highChar ) {
122 // Output text content without any escaping; ignore attribute values
123 public override void WriteWhitespace( string ws ) {
124 if ( !base.inAttributeValue ) {
129 // Output text content without any escaping; ignore attribute values
130 public override void WriteString( string textBlock ) {
131 if ( !base.inAttributeValue ) {
132 base.WriteRaw( textBlock );
136 // Output text content without any escaping; ignore attribute values
137 public override void WriteChars( char[] buffer, int index, int count ) {
138 if ( !base.inAttributeValue ) {
139 base.WriteRaw( buffer, index, count );
143 // Output text content without any escaping; ignore attribute values
144 public override void WriteRaw( char[] buffer, int index, int count ) {
145 if ( !base.inAttributeValue ) {
146 base.WriteRaw( buffer, index, count );
150 // Output text content without any escaping; ignore attribute values
151 public override void WriteRaw( string data ) {
152 if ( !base.inAttributeValue ) {
153 base.WriteRaw( data );