XmlWriter

XmlWriter class

Represents a writer that provides a fast, non-cached, forward-only way to generate streams or files that contain XML data.

class XmlWriter : public System::IDisposable

Methods

MethodDescription
virtual void Close()When overridden in a derived class, closes 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.
virtual void Flush()When overridden in a derived class, flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.
virtual SharedPtr<XmlWriterSettings> get_Settings()Returns the XmlWriterSettings object used to create this XmlWriter instance.
virtual System::Xml::WriteState get_WriteState()When overridden in a derived class, gets the state of the writer.
virtual String get_XmlLang()When overridden in a derived class, gets the current xml:lang scope.
virtual System::Xml::XmlSpace get_XmlSpace()When overridden in a derived class, gets 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.
virtual String LookupPrefix(String)When overridden in a derived class, returns 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.
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.
virtual void WriteBase64(ArrayPtr<uint8_t>, int32_t, int32_t)When overridden in a derived class, encodes the specified binary bytes as Base64 and writes out the resulting text.
virtual void WriteBinHex(ArrayPtr<uint8_t>, int32_t, int32_t)When overridden in a derived class, encodes the specified binary bytes as BinHex and writes out the resulting text.
virtual void WriteCData(String)When overridden in a derived class, writes out a block containing the specified text.
virtual void WriteCharEntity(char16_t)When overridden in a derived class, forces the generation of a character entity for the specified Unicode character value.
virtual void WriteChars(ArrayPtr<char16_t>, int32_t, int32_t)When overridden in a derived class, writes text one buffer at a time.
virtual void WriteComment(String)When overridden in a derived class, writes out a comment **** containing the specified text.
virtual void WriteDocType(const String&, const String&, const String&, const String&)When overridden in a derived class, writes 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.
virtual void WriteEndAttribute()When overridden in a derived class, closes the previous XmlWriter::WriteStartAttribute(String,String) call.
virtual void WriteEndDocument()When overridden in a derived class, closes any open elements or attributes and puts the writer back in the Start state.
virtual void WriteEndElement()When overridden in a derived class, closes one element and pops the corresponding namespace scope.
virtual void WriteEntityRef(const String&)When overridden in a derived class, writes out an entity reference as &name;.
virtual void WriteFullEndElement()When overridden in a derived class, closes one element and pops the corresponding namespace scope.
virtual void WriteName(const String&)When overridden in a derived class, writes out the specified name, ensuring it is a valid name according to the W3C XML 1.0 recommendation (https://www.w3.org/TR/1998/REC-xml-19980210#NT-Name).
virtual void WriteNmToken(const String&)When overridden in a derived class, writes out the specified name, ensuring it is a valid NmToken according to the W3C XML 1.0 recommendation (https://www.w3.org/TR/1998/REC-xml-19980210#NT-Name).
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.
virtual void WriteProcessingInstruction(String, String)When overridden in a derived class, writes out a processing instruction with a space between the name and text as follows: .
virtual void WriteQualifiedName(const String&, const String&)When overridden in a derived class, writes out the namespace-qualified name. This method looks up the prefix that is in scope for the given namespace.
virtual void WriteRaw(ArrayPtr<char16_t>, int32_t, int32_t)When overridden in a derived class, writes raw markup manually from a character buffer.
virtual void WriteRaw(const String&)When overridden in a derived class, writes raw markup manually from a string.
void WriteStartAttribute(const String&, const String&)Writes the start of an attribute with the specified local name and namespace URI.
virtual void WriteStartAttribute(const String&, const String&, const String&)When overridden in a derived class, writes the start of an attribute with the specified prefix, local name, and namespace URI.
void WriteStartAttribute(const String&)Writes the start of an attribute with the specified local name.
virtual void WriteStartDocument()When overridden in a derived class, writes the XML declaration with the version "1.0".
virtual void WriteStartDocument(bool)When overridden in a derived class, writes the XML declaration with the version "1.0" and the standalone attribute.
void WriteStartElement(const String&, const String&)When overridden in a derived class, writes the specified start tag and associates it with the given namespace.
virtual void WriteStartElement(const String&, const String&, const String&)When overridden in a derived class, writes the specified start tag and associates it with the given namespace and prefix.
void WriteStartElement(const String&)When overridden in a derived class, writes out a start tag with the specified local name.
virtual void WriteString(const String&)When overridden in a derived class, writes the given text content.
virtual void WriteSurrogateCharEntity(char16_t, char16_t)When overridden in a derived class, generates 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.
virtual void WriteWhitespace(String)When overridden in a derived class, writes out the given white space.
virtual ~Object()Destroys object. Frees all internal data structures.

Typedefs

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

See Also