XmlTextWriter

XmlTextWriter class

Represents a writer that provides a fast, non-cached, forward-only way of generating streams or files containing XML data that conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations.

class XmlTextWriter : public System::Xml::XmlWriter

Methods

MethodDescription
void Close() overrideCloses this stream and the underlying stream.
static SharedPtr<XmlWriter> Create(const String&)Creates a new XmlWriter instance using the specified filename.
static SharedPtr<XmlWriter> Create(const String&, SharedPtr<XmlWriterSettings>)Creates a new XmlWriter instance using the filename and XmlWriterSettings object.
static SharedPtr<XmlWriter> Create(const SharedPtr<IO::Stream>&)Creates a new XmlWriter instance using the specified stream.
static SharedPtr<XmlWriter> Create(const SharedPtr<IO::Stream>&, SharedPtr<XmlWriterSettings>)Creates a new XmlWriter instance using the stream and XmlWriterSettings object.
static SharedPtr<XmlWriter> Create(const SharedPtr<IO::TextWriter>&)Creates a new XmlWriter instance using the specified TextWriter.
static SharedPtr<XmlWriter> Create(const SharedPtr<IO::TextWriter>&, SharedPtr<XmlWriterSettings>)Creates a new XmlWriter instance using the TextWriter and XmlWriterSettings objects.
static SharedPtr<XmlWriter> Create(const SharedPtr<Text::StringBuilder>&)Creates a new XmlWriter instance using the specified Text::StringBuilder.
static SharedPtr<XmlWriter> Create(const SharedPtr<Text::StringBuilder>&, SharedPtr<XmlWriterSettings>)Creates a new XmlWriter instance using the Text::StringBuilder and XmlWriterSettings objects.
static SharedPtr<XmlWriter> Create(const SharedPtr<XmlWriter>&)Creates a new XmlWriter instance using the specified XmlWriter object.
static SharedPtr<XmlWriter> Create(const SharedPtr<XmlWriter>&, SharedPtr<XmlWriterSettings>)Creates a new XmlWriter instance using the specified XmlWriter and XmlWriterSettings objects.
void Dispose() overrideReleases all resources used by the current instance of the XmlWriter class.
virtual bool Equals(ptr)Compares objects using C# Object.Equals semantics.
static std::enable_if<IsSmartPtr<T1>::value&&IsSmartPtr<T2>::value, bool>::type Equals(T1 const&, T2 const&)Compares reference type objects in C# style.
static std::enable_if<!IsSmartPtr<T1>::value&&!IsSmartPtr<T2>::value, bool>::type Equals(T1 const&, T2 const&)Compares value type objects in C# style.
static bool Equals(float const&, float const&)Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN.
static bool Equals(double const&, double const&)Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN.
virtual bool FastCast(const Details::FastRttiBase&, void **) constFor internal purposes only.
void Flush() overrideFlushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.
SharedPtr<IO::Stream> get_BaseStream()Returns the underlying stream object.
System::Xml::Formatting get_Formatting()Indicates how the output is formatted.
int32_t get_Indentation()Returns how many IndentChars to write for each level in the hierarchy when XmlTextWriter::set_Formatting is set to Formatting::Indented.
char16_t get_IndentChar()Returns which character to use for indenting when XmlTextWriter::set_Formatting is set to Formatting::Indented.
bool get_Namespaces()Returns a value indicating whether to do namespace support.
char16_t get_QuoteChar()Returns which character to use to quote attribute values.
virtual SharedPtr<XmlWriterSettings> get_Settings()Returns the XmlWriterSettings object used to create this XmlWriter instance.
System::Xml::WriteState get_WriteState() overrideReturns the state of the writer.
String get_XmlLang() overrideReturns the current xml:lang scope.
System::Xml::XmlSpace get_XmlSpace() overrideReturns an XmlSpace representing the current xml:space scope.
Detail::SmartPtrCounter * GetCounter()Gets reference counter data structure associated with the object.
virtual int32_t GetHashCode() constAnalog of C# Object.GetHashCode() method. Enables hashing of custom objects.
virtual const TypeInfo& GetType() constGets actual type of object. Analog of C# System.Object.GetType() call.
virtual bool Is(const TypeInfo&) constCheck if object represents an instance of type described by targetType. Analog of C# ‘is’ operator.
void Lock()Implements C# lock() statement locking. Call directly or use LockContext sentry object.
String LookupPrefix(String) overrideReturns the closest prefix defined in the current namespace scope for the namespace URI.
virtual ptr MemberwiseClone() constAnalog of C# Object.MemberwiseClone() method. Enables cloning custom types.
Object()Creates object. Initializes all internal data structures.
Object(Object const&)Copy constructor. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses.
Object& operator=(Object const&)Assignment operator. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses.
static bool ReferenceEquals(ptr const&, ptr const&)Compares objects by reference.
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, T const&)Compares objects by reference.
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, std::nullptr_t)Reference-compares value type object with nullptr.
bool ReferenceEquals(String const&, std::nullptr_t)Specialization of Object::ReferenceEquals for case of string and nullptr.
bool ReferenceEquals(String const&, String const&)Specialization of Object::ReferenceEquals for case of strings.
int RemovedSharedRefs(int)Decreases shared reference count by specified value.
void set_Formatting(System::Xml::Formatting)Indicates how the output is formatted.
void set_Indentation(int32_t)Sets how many IndentChars to write for each level in the hierarchy when XmlTextWriter::set_Formatting is set to Formatting::Indented.
void set_IndentChar(char16_t)Sets which character to use for indenting when XmlTextWriter::set_Formatting is set to Formatting::Indented.
void set_Namespaces(bool)Sets a value indicating whether to do namespace support.
void set_QuoteChar(char16_t)Sets which character to use to quote attribute values.
virtual void SetTemplateWeakPtr(uint32_t)Set n’th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode.
int SharedCount() constGets current value of shared reference counter.
Object * SharedRefAdded()Increments shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
int SharedRefRemovedSafe()Decrements and returns shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
virtual String ToString() constAnalog of C# Object.ToString() method. Enables converting custom objects to string.
static const TypeInfo& Type()Implements C# typeof(System.Object) construct.
void Unlock()Implements C# lock() statement unlocking. Call directly or use LockContext sentry object.
Detail::SmartPtrCounter * WeakRefAdded()Increments weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
void WeakRefRemoved()Decrements weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
virtual void WriteAttributes(SharedPtr<XmlReader>, bool)When overridden in a derived class, writes out all the attributes found at the current position in the XmlReader.
void WriteAttributeString(const String&, const String&, const String&)When overridden in a derived class, writes an attribute with the specified local name, namespace URI, and value.
void WriteAttributeString(const String&, const String&)When overridden in a derived class, writes out the attribute with the specified local name and value.
void WriteAttributeString(const String&, const String&, const String&, const String&)When overridden in a derived class, writes out the attribute with the specified prefix, local name, namespace URI, and value.
void WriteBase64(ArrayPtr<uint8_t>, int32_t, int32_t) overrideEncodes the specified binary bytes as base64 and writes out the resulting text.
void WriteBinHex(ArrayPtr<uint8_t>, int32_t, int32_t) overrideEncodes the specified binary bytes as binhex and writes out the resulting text.
void WriteCData(String) overrideWrites out a block containing the specified text.
void WriteCharEntity(char16_t) overrideForces the generation of a character entity for the specified Unicode character value.
void WriteChars(ArrayPtr<char16_t>, int32_t, int32_t) overrideWrites text one buffer at a time.
void WriteComment(String) overrideWrites out a comment **** containing the specified text.
void WriteDocType(const String&, const String&, const String&, const String&) overrideWrites the DOCTYPE declaration with the specified name and optional attributes.
void WriteElementString(const String&, const String&)Writes an element with the specified local name and value.
void WriteElementString(const String&, const String&, const String&)Writes an element with the specified local name, namespace URI, and value.
void WriteElementString(const String&, const String&, const String&, const String&)Writes an element with the specified prefix, local name, namespace URI, and value.
void WriteEndAttribute() overrideCloses the previous XmlTextWriter::WriteStartAttribute call.
void WriteEndDocument() overrideCloses any open elements or attributes and puts the writer back in the Start state.
void WriteEndElement() overrideCloses one element and pops the corresponding namespace scope.
void WriteEntityRef(const String&) overrideWrites out an entity reference as &name;.
void WriteFullEndElement() overrideCloses one element and pops the corresponding namespace scope.
void WriteName(const String&) overrideWrites out the specified name, ensuring it is a valid name according to the W3C XML 1.0 recommendation.
void WriteNmToken(const String&) overrideWrites out the specified name, ensuring it is a valid NmToken according to the W3C XML 1.0 recommendation.
virtual void WriteNode(SharedPtr<XmlReader>, bool)When overridden in a derived class, copies everything from the reader to the writer and moves the reader to the start of the next sibling.
virtual void WriteNode(SharedPtr<XPath::XPathNavigator>, bool)Copies everything from the XPathNavigator object to the writer. The position of the XPathNavigator remains unchanged.
void WriteProcessingInstruction(String, String) overrideWrites out a processing instruction with a space between the name and text as follows: .
void WriteQualifiedName(const String&, const String&) overrideWrites out the namespace-qualified name. This method looks up the prefix that is in scope for the given namespace.
void WriteRaw(ArrayPtr<char16_t>, int32_t, int32_t) overrideWrites raw markup manually from a character buffer.
void WriteRaw(const String&) overrideWrites raw markup manually from a string.
void WriteStartAttribute(const String&, const String&, const String&) overrideWrites the start of an attribute.
void WriteStartAttribute(const String&, const String&)Writes the start of an attribute with the specified local name and namespace URI.
void WriteStartAttribute(const String&)Writes the start of an attribute with the specified local name.
void WriteStartDocument() overrideWrites the XML declaration with the version "1.0".
void WriteStartDocument(bool) overrideWrites the XML declaration with the version "1.0" and the standalone attribute.
void WriteStartElement(const String&, const String&, const String&) overrideWrites the specified start tag and associates it with the given namespace and prefix.
void WriteStartElement(const String&, const String&)When overridden in a derived class, writes the specified start tag and associates it with the given namespace.
void WriteStartElement(const String&)When overridden in a derived class, writes out a start tag with the specified local name.
void WriteString(const String&) overrideWrites the given text content.
void WriteSurrogateCharEntity(char16_t, char16_t) overrideGenerates and writes the surrogate character entity for the surrogate character pair.
virtual void WriteValue(SharedPtr<Object>)Writes the object value.
virtual void WriteValue(const String&)Writes a String value.
virtual void WriteValue(bool)Writes a Boolean value.
virtual void WriteValue(DateTime)Writes a DateTime value.
virtual void WriteValue(DateTimeOffset)Writes a DateTimeOffset value.
virtual void WriteValue(double)Writes a Double value.
virtual void WriteValue(float)Writes a single-precision floating-point number.
virtual void WriteValue(Decimal)Writes a Decimal value.
virtual void WriteValue(int32_t)Writes a Int32 value.
virtual void WriteValue(int64_t)Writes a Int64 value.
void WriteWhitespace(String) overrideWrites out the given white space.
XmlTextWriter(const SharedPtr<IO::Stream>&, const SharedPtr<Text::Encoding>&)Creates an instance of the XmlTextWriter class using the specified stream and encoding.
XmlTextWriter(const String&, const SharedPtr<Text::Encoding>&)Creates an instance of the XmlTextWriter class using the specified file.
XmlTextWriter(const SharedPtr<IO::TextWriter>&)Creates an instance of the XmlTextWriter class using the specified TextWriter.
virtual ~Object()Destroys object. Frees all internal data structures.

Typedefs

TypedefDescription
PtrAn alias for shared pointer to an instance of this class.

Remarks

It is recommended to use the XmlWriter class instead.

Objects of this class should only be allocated using System::MakeObject() function. Never create instances of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

See Also