10 [global::__DynamicallyInvokable]
11 [PermissionSet(
SecurityAction.InheritanceDemand, Name =
"FullTrust")]
14 private bool useAsync;
18 private bool omitXmlDecl;
22 private string newLineChars;
24 private TriState indent;
26 private string indentChars;
28 private bool newLineOnAttributes;
30 private bool closeOutput;
36 private bool checkCharacters;
38 private bool writeEndDocumentOnClose;
44 private bool doNotEscapeUriAttributes;
46 private bool mergeCDataSections;
48 private string mediaType;
50 private string docTypeSystem;
52 private string docTypePublic;
54 private XmlStandalone standalone;
56 private bool autoXmlDecl;
58 private bool isReadOnly;
63 [global::__DynamicallyInvokable]
66 [global::__DynamicallyInvokable]
71 [global::__DynamicallyInvokable]
74 CheckReadOnly(
"Async");
81 [global::__DynamicallyInvokable]
84 [global::__DynamicallyInvokable]
89 [global::__DynamicallyInvokable]
92 CheckReadOnly(
"Encoding");
100 [global::__DynamicallyInvokable]
103 [global::__DynamicallyInvokable]
108 [global::__DynamicallyInvokable]
111 CheckReadOnly(
"OmitXmlDeclaration");
118 [global::__DynamicallyInvokable]
121 [global::__DynamicallyInvokable]
124 return newLineHandling;
126 [global::__DynamicallyInvokable]
129 CheckReadOnly(
"NewLineHandling");
130 if ((uint)value > 2u)
134 newLineHandling = value;
141 [global::__DynamicallyInvokable]
144 [global::__DynamicallyInvokable]
149 [global::__DynamicallyInvokable]
152 CheckReadOnly(
"NewLineChars");
157 newLineChars = value;
164 [global::__DynamicallyInvokable]
167 [global::__DynamicallyInvokable]
170 return indent == TriState.True;
172 [global::__DynamicallyInvokable]
175 CheckReadOnly(
"Indent");
176 indent = (value ? TriState.True : TriState.False);
183 [global::__DynamicallyInvokable]
186 [global::__DynamicallyInvokable]
191 [global::__DynamicallyInvokable]
194 CheckReadOnly(
"IndentChars");
206 [global::__DynamicallyInvokable]
209 [global::__DynamicallyInvokable]
212 return newLineOnAttributes;
214 [global::__DynamicallyInvokable]
217 CheckReadOnly(
"NewLineOnAttributes");
218 newLineOnAttributes = value;
225 [global::__DynamicallyInvokable]
228 [global::__DynamicallyInvokable]
233 [global::__DynamicallyInvokable]
236 CheckReadOnly(
"CloseOutput");
243 [global::__DynamicallyInvokable]
246 [global::__DynamicallyInvokable]
249 return conformanceLevel;
251 [global::__DynamicallyInvokable]
254 CheckReadOnly(
"ConformanceLevel");
255 if ((uint)value > 2u)
259 conformanceLevel = value;
266 [global::__DynamicallyInvokable]
269 [global::__DynamicallyInvokable]
272 return checkCharacters;
274 [global::__DynamicallyInvokable]
277 CheckReadOnly(
"CheckCharacters");
278 checkCharacters = value;
284 [global::__DynamicallyInvokable]
287 [global::__DynamicallyInvokable]
290 return namespaceHandling;
292 [global::__DynamicallyInvokable]
295 CheckReadOnly(
"NamespaceHandling");
296 if ((uint)value > 1u)
300 namespaceHandling = value;
307 [global::__DynamicallyInvokable]
310 [global::__DynamicallyInvokable]
313 return writeEndDocumentOnClose;
315 [global::__DynamicallyInvokable]
318 CheckReadOnly(
"WriteEndDocumentOnClose");
319 writeEndDocumentOnClose = value;
333 outputMethod = value;
346 return doNotEscapeUriAttributes;
350 CheckReadOnly(
"DoNotEscapeUriAttributes");
351 doNotEscapeUriAttributes = value;
355 internal bool MergeCDataSections
359 return mergeCDataSections;
363 CheckReadOnly(
"MergeCDataSections");
364 mergeCDataSections = value;
368 internal string MediaType
376 CheckReadOnly(
"MediaType");
381 internal string DocTypeSystem
385 return docTypeSystem;
389 CheckReadOnly(
"DocTypeSystem");
390 docTypeSystem = value;
394 internal string DocTypePublic
398 return docTypePublic;
402 CheckReadOnly(
"DocTypePublic");
403 docTypePublic = value;
407 internal XmlStandalone Standalone
415 CheckReadOnly(
"Standalone");
420 internal bool AutoXmlDeclaration
428 CheckReadOnly(
"AutoXmlDeclaration");
433 internal TriState IndentInternal
445 internal bool IsQuerySpecific
449 if (cdataSections.
Count == 0 && docTypePublic ==
null && docTypeSystem ==
null)
451 return standalone == XmlStandalone.Yes;
457 internal bool ReadOnly
470 [global::__DynamicallyInvokable]
477 [global::__DynamicallyInvokable]
480 CheckReadOnly(
"Reset");
486 [global::__DynamicallyInvokable]
491 xmlWriterSettings.isReadOnly =
false;
492 return xmlWriterSettings;
495 internal XmlWriter CreateWriter(
string outputFileName)
497 if (outputFileName ==
null)
502 if (!xmlWriterSettings.CloseOutput)
504 xmlWriterSettings = xmlWriterSettings.Clone();
505 xmlWriterSettings.CloseOutput =
true;
511 return xmlWriterSettings.CreateWriter(fileStream);
520 internal XmlWriter CreateWriter(
Stream output)
524 throw new ArgumentNullException(
"output");
532 xmlWriter = ((!
Indent) ?
new XmlUtf8RawTextWriter(output,
this) :
new XmlUtf8RawTextWriterIndent(output,
this));
535 xmlWriter = ((!
Indent) ?
new HtmlUtf8RawTextWriter(output,
this) :
new HtmlUtf8RawTextWriterIndent(output,
this));
538 xmlWriter =
new TextUtf8RawTextWriter(output,
this);
541 xmlWriter =
new XmlAutoDetectWriter(output,
this);
552 xmlWriter = ((!
Indent) ?
new XmlEncodedRawTextWriter(output,
this) :
new XmlEncodedRawTextWriterIndent(output,
this));
555 xmlWriter = ((!
Indent) ?
new HtmlEncodedRawTextWriter(output,
this) :
new HtmlEncodedRawTextWriterIndent(output,
this));
558 xmlWriter =
new TextEncodedRawTextWriter(output,
this);
561 xmlWriter =
new XmlAutoDetectWriter(output,
this);
569 xmlWriter =
new QueryOutputWriter((XmlRawWriter)xmlWriter,
this);
571 xmlWriter =
new XmlWellFormedWriter(xmlWriter,
this);
574 xmlWriter =
new XmlAsyncCheckWriter(xmlWriter);
579 internal XmlWriter CreateWriter(
TextWriter output)
583 throw new ArgumentNullException(
"output");
589 xmlWriter = ((!
Indent) ?
new XmlEncodedRawTextWriter(output,
this) :
new XmlEncodedRawTextWriterIndent(output,
this));
592 xmlWriter = ((!
Indent) ?
new HtmlEncodedRawTextWriter(output,
this) :
new HtmlEncodedRawTextWriterIndent(output,
this));
595 xmlWriter =
new TextEncodedRawTextWriter(output,
this);
598 xmlWriter =
new XmlAutoDetectWriter(output,
this);
605 xmlWriter =
new QueryOutputWriter((XmlRawWriter)xmlWriter,
this);
607 xmlWriter =
new XmlWellFormedWriter(xmlWriter,
this);
610 xmlWriter =
new XmlAsyncCheckWriter(xmlWriter);
615 internal XmlWriter CreateWriter(XmlWriter output)
619 throw new ArgumentNullException(
"output");
621 return AddConformanceWrapper(output);
624 private void CheckReadOnly(
string propertyName)
628 throw new XmlException(
"Xml_ReadOnlyProperty", GetType().Name +
"." + propertyName);
632 private void Initialize()
637 newLineChars = Environment.NewLine;
638 indent = TriState.Unknown;
640 newLineOnAttributes =
false;
644 checkCharacters =
true;
645 writeEndDocumentOnClose =
true;
647 cdataSections.
Clear();
648 mergeCDataSections =
false;
650 docTypeSystem =
null;
651 docTypePublic =
null;
652 standalone = XmlStandalone.Omit;
653 doNotEscapeUriAttributes =
false;
658 private XmlWriter AddConformanceWrapper(XmlWriter baseWriter)
663 bool checkNames =
false;
666 if (settings ==
null)
681 if (this.conformanceLevel != settings.ConformanceLevel)
686 if (checkCharacters && !settings.CheckCharacters)
698 XmlWriter xmlWriter = baseWriter;
701 if (conformanceLevel != 0)
703 xmlWriter =
new XmlWellFormedWriter(xmlWriter,
this);
707 xmlWriter =
new XmlCharCheckingWriter(xmlWriter, flag, checkNames, flag2,
NewLineChars);
710 if (IsQuerySpecific && (settings ==
null || !settings.IsQuerySpecific))
712 xmlWriter =
new QueryOutputWriterV1(xmlWriter,
this);
717 internal void GetObjectData(XmlQueryDataWriter writer)
723 writer.Write((sbyte)IndentInternal);
729 writer.Write((sbyte)outputMethod);
730 writer.Write(cdataSections.
Count);
731 foreach (XmlQualifiedName cdataSection
in cdataSections)
733 writer.Write(cdataSection.Name);
734 writer.Write(cdataSection.Namespace);
736 writer.Write(mergeCDataSections);
737 writer.WriteStringQ(mediaType);
738 writer.WriteStringQ(docTypeSystem);
739 writer.WriteStringQ(docTypePublic);
740 writer.Write((sbyte)standalone);
741 writer.Write(autoXmlDecl);
742 writer.Write(ReadOnly);
751 IndentInternal = (TriState)reader.ReadSByte(-1, 1);
758 int num = reader.ReadInt32();
760 for (
int i = 0; i < num; i++)
762 cdataSections.Add(
new XmlQualifiedName(reader.ReadString(), reader.ReadString()));
764 mergeCDataSections = reader.ReadBoolean();
765 mediaType = reader.ReadStringQ();
766 docTypeSystem = reader.ReadStringQ();
767 docTypePublic = reader.ReadStringQ();
768 Standalone = (XmlStandalone)reader.ReadSByte(0, 2);
769 autoXmlDecl = reader.ReadBoolean();
770 ReadOnly = reader.ReadBoolean();
Represents a character encoding.To browse the .NET Framework source code for this type,...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
bool CheckCharacters
Gets or sets a value that indicates whether the XML writer should check to ensure that all characters...
XmlWriterSettings Clone()
Creates a copy of the T:System.Xml.XmlWriterSettings instance.
bool OmitXmlDeclaration
Gets or sets a value indicating whether to omit an XML declaration.
int Count
Gets the number of elements contained in the T:System.Collections.Generic.List`1.
string IndentChars
Gets or sets the character string to use when indenting. This setting is used when the P:System....
bool? Indent
Gets or sets a value indicating whether to indent elements.
FileMode
Specifies how the operating system should open a file.
The exception that is thrown when the value of an argument is outside the allowable range of values a...
NamespaceHandling NamespaceHandling
Gets or sets a value that indicates whether the T:System.Xml.XmlWriter should remove duplicate namesp...
bool NewLineOnAttributes
Gets or sets a value indicating whether to write attributes on a new line.
static Encoding GetEncoding(int codepage)
Returns the encoding associated with the specified code page identifier.
NewLineHandling
Specifies how to handle line breaks.
Represents a writer that provides a fast, non-cached, forward-only way to generate streams or files t...
string NewLineChars
Gets or sets the character string to use for line breaks.
SecurityAction
Specifies the security actions that can be performed using declarative security.
virtual void Close()
Closes the current stream and releases any resources (such as sockets and file handles) associated wi...
void Reset()
Resets the members of the settings class to their default values.
ConformanceLevel ConformanceLevel
Gets or sets the level of conformance that the XML writer checks the XML output for.
virtual string WebName
When overridden in a derived class, gets the name registered with the Internet Assigned Numbers Autho...
virtual int CodePage
When overridden in a derived class, gets the code page identifier of the current T:System....
ConformanceLevel
Specifies the amount of input or output checking that T:System.Xml.XmlReader and T:System....
NamespaceHandling
Specifies whether to remove duplicate namespace declarations in the T:System.Xml.XmlWriter.
Provides a T:System.IO.Stream for a file, supporting both synchronous and asynchronous read and write...
Represents a writer that can write a sequential series of characters. This class is abstract.
bool WriteEndDocumentOnClose
Gets or sets a value that indicates whether the T:System.Xml.XmlWriter will add closing tags to all u...
XmlOutputMethod OutputMethod
Gets the method used to serialize the T:System.Xml.XmlWriter output.
NewLineHandling NewLineHandling
Gets or sets a value indicating whether to normalize line breaks in the output.
Specifies a set of features to support on the T:System.Xml.XmlWriter object created by the Overload:S...
void Clear()
Removes all elements from the T:System.Collections.Generic.List`1.
bool Async
Gets or sets a value that indicates whether asynchronous T:System.Xml.XmlWriter methods can be used o...
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
FileAccess
Defines constants for read, write, or read/write access to a file.
static Encoding UTF8
Gets an encoding for the UTF-8 format.
bool DoNotEscapeUriAttributes
Gets or sets a value that indicates whether the T:System.Xml.XmlWriter does not escape URI attributes...
XmlOutputMethod
Specifies the method used to serialize the T:System.Xml.XmlWriter output.
XmlWriterSettings()
Initializes a new instance of the T:System.Xml.XmlWriterSettings class.
FileShare
Contains constants for controlling the kind of access other T:System.IO.FileStream objects can have t...
bool CloseOutput
Gets or sets a value indicating whether the T:System.Xml.XmlWriter should also close the underlying s...
Provides a generic view of a sequence of bytes. This is an abstract class.To browse the ....