Class System.Xml.XmlWriterImplementation
Provides a base class for implementing an XML writer that writes XML documents and fragments. This class is abstract and must be inherited.
Namespace:
System.Xml
Assembly:
System.Xml.dll
Inheritance Hierarchy
System.Object
↳
System.Xml.XmlWriter
↳
System.Xml.XmlWriterImplementation
Syntax
public abstract class XmlWriterImplementation : XmlWriter
Remarks
The XmlWriterImplementation
class provides a base for creating custom XmlWriter
implementations. It defines abstract methods and properties that derived classes must implement to handle XML writing operations. This allows for flexible and extensible XML generation in various scenarios, such as writing to different output streams, applying custom formatting, or enforcing specific XML standards.
Note: You typically do not need to inherit from XmlWriterImplementation
directly. For most scenarios, using the static methods on the XmlWriter
class (e.g., XmlWriter.Create()
) is sufficient, as they return concrete XmlWriter
implementations configured with various settings. Inheriting from this class is for advanced customization scenarios.
Members
Properties
- CloseOutput: Gets a value indicating whether the writer should close the underlying stream on
Dispose()
.
- Settings: Gets the
XmlWriterSettings
object used to create this XmlWriter
instance.
- WriteState: Gets the state of the writer.
- XmlLang: Gets the current xml:lang scope.
- XmlSpace: Gets the current xml:space scope.
Methods
- Flush(): Flushes whatever in the buffer is written to the underlying stream.
- WriteAttributes(XmlReader reader): Writes the attributes of the current node and all its descendants from the specified
XmlReader
.
- WriteAttributeString(string prefix, string localName, string namespaceURI, string value): Writes an attribute with the specified prefix, local name, namespace, and value.
- WriteAttributeString(string localName, string value): Writes an attribute with the specified local name and value.
- WriteAttributeString(string namespaceURI, string localName, string value): Writes an attribute with the specified namespace, local name, and value.
- WriteAttributeString(string prefix, string localName, string value): Writes an attribute with the specified prefix, local name, and value.
- WriteBase64(byte[] buffer, int index, int count): Writes out a base64 encoded string value.
- WriteBinHex(byte[] buffer, int index, int count): Writes out a BinHex encoded string value.
- WriteCData(string text): Writes a comment.
- WriteCharEntity(char ch): Writes a character entity.
- WriteChars(char[] buffer, int index, int count): Writes a block of characters.
- WriteComment(string text): Writes a comment.
- WriteDocType(string name, string pubid, string sysid, string subset): Writes the XML declaration along with the DOCTYPE.
- WriteEndAttribute(): Closes the current attribute.
- WriteEndDocument(): Closes any open elements or attributes and leaves the writer in the initial state.
- WriteEndElement(): Closes the current element and advances the writer to the parent element.
- WriteEndElement(string prefix, string localName, string namespaceURI): Closes the current element and advances the writer to the parent element.
- WriteEndElement(string localName): Closes the current element and advances the writer to the parent element.
- WriteEndElement(string namespaceURI, string localName): Closes the current element and advances the writer to the parent element.
- WriteEntityRef(string name): Writes an entity reference.
- WriteFullEndElement(): Closes the current element and advances the writer to the parent element. This is used to write a self-closing element.
- WriteName(string name): Writes a name.
- WriteName(string prefix, string localName): Writes a qualified name.
- WriteNamespace(string prefix, string namespaceURI): Writes out a namespace declaration.
- WriteNode(XmlReader reader, bool defattr): Writes the node from the given
XmlReader
to the writer.
- WriteProcessingInstruction(string name, string text): Writes a processing instruction.
- WriteQualifiedName(string localName, string namespaceURI): Writes a qualified name.
- WriteRaw(char[] buffer, int index, int count): Writes raw markup, characters, or text.
- WriteRaw(string data): Writes raw markup, characters, or text.
- WriteRaw(XmlReader reader): Writes the specified XML data to the writer.
- WriteStartAttribute(string prefix, string localName, string namespaceURI): Writes the beginning of an attribute.
- WriteStartAttribute(string localName): Writes the beginning of an attribute.
- WriteStartAttribute(string namespaceURI, string localName): Writes the beginning of an attribute.
- WriteStartAttribute(string prefix, string localName): Writes the beginning of an attribute.
- WriteStartDocument(): Writes the XML declaration, with no version or encoding information.
- WriteStartDocument(bool standalone): Writes the XML declaration, with optional standalone attribute.
- WriteStartElement(string prefix, string localName, string namespaceURI): Writes the beginning of a start tag for the element that has the specified prefix, local name, and namespace.
- WriteStartElement(string localName): Writes the beginning of a start tag for the element that has the specified local name.
- WriteStartElement(string namespaceURI, string localName): Writes the beginning of a start tag for the element that has the specified namespace and local name.
- WriteStartElement(string prefix, string localName): Writes the beginning of a start tag for the element that has the specified prefix and local name.
- WriteString(string text): Writes the text content of the current node.
- WriteSurrogateCharEntity(char lowChar, char highChar): Writes a surrogate character entity.
- WriteValue(object value): Writes the value of the specified object.
- WriteValue(string value): Writes the value of the specified string.
- WriteValue(int value): Writes the value of the specified integer.
- WriteValue(double value): Writes the value of the specified double.
- WriteValue(bool value): Writes the value of the specified boolean.
- WriteValue(DateTime value): Writes the value of the specified DateTime.
- WriteXmlDeclaration(string version, string encoding, string standalone): Writes the XML declaration.
- WriteXmlDeclaration(string value): Writes the XML declaration.
See Also