CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
System::Xml::XmlTextWriter Class Reference

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. More...

#include <xml_text_writer.h>

Inherits System::Xml::XmlWriter.

Public Types

using Ptr = SharedPtr< XmlTextWriter >
 An alias for shared pointer to an instance of this class. More...
 
- Public Types inherited from System::Xml::XmlWriter
using Ptr = SharedPtr< XmlWriter >
 An alias for shared pointer to an instance of this class. More...
 
- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 

Public Member Functions

SharedPtr< IO::Streamget_BaseStream ()
 Returns the underlying stream object. More...
 
bool get_Namespaces ()
 Returns a value indicating whether to do namespace support. More...
 
void set_Namespaces (bool value)
 Sets a value indicating whether to do namespace support. More...
 
System::Xml::Formatting get_Formatting ()
 Indicates how the output is formatted. More...
 
void set_Formatting (System::Xml::Formatting value)
 Indicates how the output is formatted. More...
 
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. More...
 
void set_Indentation (int32_t value)
 Sets how many IndentChars to write for each level in the hierarchy when XmlTextWriter::set_Formatting is set to Formatting::Indented. More...
 
char16_t get_IndentChar ()
 Returns which character to use for indenting when XmlTextWriter::set_Formatting is set to Formatting::Indented. More...
 
void set_IndentChar (char16_t value)
 Sets which character to use for indenting when XmlTextWriter::set_Formatting is set to Formatting::Indented. More...
 
char16_t get_QuoteChar ()
 Returns which character to use to quote attribute values. More...
 
void set_QuoteChar (char16_t value)
 Sets which character to use to quote attribute values. More...
 
System::Xml::WriteState get_WriteState () override
 Returns the state of the writer. More...
 
System::Xml::XmlSpace get_XmlSpace () override
 Returns an XmlSpace representing the current xml:space scope. More...
 
String get_XmlLang () override
 Returns the current xml:lang scope. More...
 
 XmlTextWriter (const SharedPtr< IO::Stream > &w, const SharedPtr< Text::Encoding > &encoding)
 Creates an instance of the XmlTextWriter class using the specified stream and encoding. More...
 
 XmlTextWriter (const String &filename, const SharedPtr< Text::Encoding > &encoding)
 Creates an instance of the XmlTextWriter class using the specified file. More...
 
 XmlTextWriter (const SharedPtr< IO::TextWriter > &w)
 Creates an instance of the XmlTextWriter class using the specified TextWriter. More...
 
void WriteStartDocument () override
 Writes the XML declaration with the version "1.0". More...
 
void WriteStartDocument (bool standalone) override
 Writes the XML declaration with the version "1.0" and the standalone attribute. More...
 
void WriteEndDocument () override
 Closes any open elements or attributes and puts the writer back in the Start state. More...
 
void WriteDocType (const String &name, const String &pubid, const String &sysid, const String &subset) override
 Writes the DOCTYPE declaration with the specified name and optional attributes. More...
 
void WriteStartElement (const String &prefix, const String &localName, const String &ns) override
 Writes the specified start tag and associates it with the given namespace and prefix. More...
 
void WriteEndElement () override
 Closes one element and pops the corresponding namespace scope. More...
 
void WriteFullEndElement () override
 Closes one element and pops the corresponding namespace scope. More...
 
void WriteStartAttribute (const String &prefix, const String &localName, const String &ns) override
 Writes the start of an attribute. More...
 
void WriteEndAttribute () override
 Closes the previous XmlTextWriter::WriteStartAttribute call. More...
 
void WriteCData (String text) override
 Writes out a ... block containing the specified text. More...
 
void WriteComment (String text) override
 Writes out a comment containing the specified text. More...
 
void WriteProcessingInstruction (String name, String text) override
 Writes out a processing instruction with a space between the name and text as follows: <?name text?>. More...
 
void WriteEntityRef (const String &name) override
 Writes out an entity reference as &name;. More...
 
void WriteCharEntity (char16_t ch) override
 Forces the generation of a character entity for the specified Unicode character value. More...
 
void WriteWhitespace (String ws) override
 Writes out the given white space. More...
 
void WriteString (const String &text) override
 Writes the given text content. More...
 
void WriteSurrogateCharEntity (char16_t lowChar, char16_t highChar) override
 Generates and writes the surrogate character entity for the surrogate character pair. More...
 
void WriteChars (ArrayPtr< char16_t > buffer, int32_t index, int32_t count) override
 Writes text one buffer at a time. More...
 
void WriteRaw (ArrayPtr< char16_t > buffer, int32_t index, int32_t count) override
 Writes raw markup manually from a character buffer. More...
 
void WriteRaw (const String &data) override
 Writes raw markup manually from a string. More...
 
void WriteBase64 (ArrayPtr< uint8_t > buffer, int32_t index, int32_t count) override
 Encodes the specified binary bytes as base64 and writes out the resulting text. More...
 
void WriteBinHex (ArrayPtr< uint8_t > buffer, int32_t index, int32_t count) override
 Encodes the specified binary bytes as binhex and writes out the resulting text. More...
 
void Close () override
 Closes this stream and the underlying stream. More...
 
void Flush () override
 Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. More...
 
void WriteName (const String &name) override
 Writes out the specified name, ensuring it is a valid name according to the W3C XML 1.0 recommendation. More...
 
void WriteQualifiedName (const String &localName, const String &ns) override
 Writes out the namespace-qualified name. This method looks up the prefix that is in scope for the given namespace. More...
 
String LookupPrefix (String ns) override
 Returns the closest prefix defined in the current namespace scope for the namespace URI. More...
 
void WriteNmToken (const String &name) override
 Writes out the specified name, ensuring it is a valid NmToken according to the W3C XML 1.0 recommendation. More...
 
- Public Member Functions inherited from System::Xml::XmlWriter
virtual SharedPtr< XmlWriterSettingsget_Settings ()
 Returns the XmlWriterSettings object used to create this XmlWriter instance. More...
 
virtual System::Xml::WriteState get_WriteState ()=0
 When overridden in a derived class, gets the state of the writer. More...
 
virtual System::Xml::XmlSpace get_XmlSpace ()
 When overridden in a derived class, gets an XmlSpace representing the current xml:space scope. More...
 
virtual String get_XmlLang ()
 When overridden in a derived class, gets the current xml:lang scope. More...
 
virtual void WriteStartDocument ()=0
 When overridden in a derived class, writes the XML declaration with the version "1.0". More...
 
virtual void WriteStartDocument (bool standalone)=0
 When overridden in a derived class, writes the XML declaration with the version "1.0" and the standalone attribute. More...
 
virtual void WriteEndDocument ()=0
 When overridden in a derived class, closes any open elements or attributes and puts the writer back in the Start state. More...
 
virtual void WriteDocType (const String &name, const String &pubid, const String &sysid, const String &subset)=0
 When overridden in a derived class, writes the DOCTYPE declaration with the specified name and optional attributes. More...
 
void WriteStartElement (const String &localName, const String &ns)
 When overridden in a derived class, writes the specified start tag and associates it with the given namespace. More...
 
virtual void WriteStartElement (const String &prefix, const String &localName, const String &ns)=0
 When overridden in a derived class, writes the specified start tag and associates it with the given namespace and prefix. More...
 
void WriteStartElement (const String &localName)
 When overridden in a derived class, writes out a start tag with the specified local name. More...
 
virtual void WriteEndElement ()=0
 When overridden in a derived class, closes one element and pops the corresponding namespace scope. More...
 
virtual void WriteFullEndElement ()=0
 When overridden in a derived class, closes one element and pops the corresponding namespace scope. More...
 
void WriteAttributeString (const String &localName, const String &ns, const String &value)
 When overridden in a derived class, writes an attribute with the specified local name, namespace URI, and value. More...
 
void WriteAttributeString (const String &localName, const String &value)
 When overridden in a derived class, writes out the attribute with the specified local name and value. More...
 
void WriteAttributeString (const String &prefix, const String &localName, const String &ns, const String &value)
 When overridden in a derived class, writes out the attribute with the specified prefix, local name, namespace URI, and value. More...
 
void WriteStartAttribute (const String &localName, const String &ns)
 Writes the start of an attribute with the specified local name and namespace URI. More...
 
virtual void WriteStartAttribute (const String &prefix, const String &localName, const String &ns)=0
 When overridden in a derived class, writes the start of an attribute with the specified prefix, local name, and namespace URI. More...
 
void WriteStartAttribute (const String &localName)
 Writes the start of an attribute with the specified local name. More...
 
virtual void WriteEndAttribute ()=0
 When overridden in a derived class, closes the previous XmlWriter::WriteStartAttribute(String,String) call. More...
 
virtual void WriteCData (String text)=0
 When overridden in a derived class, writes out a ... block containing the specified text. More...
 
virtual void WriteComment (String text)=0
 When overridden in a derived class, writes out a comment containing the specified text. More...
 
virtual void WriteProcessingInstruction (String name, String text)=0
 When overridden in a derived class, writes out a processing instruction with a space between the name and text as follows: <?name text?>. More...
 
virtual void WriteEntityRef (const String &name)=0
 When overridden in a derived class, writes out an entity reference as &name;. More...
 
virtual void WriteCharEntity (char16_t ch)=0
 When overridden in a derived class, forces the generation of a character entity for the specified Unicode character value. More...
 
virtual void WriteWhitespace (String ws)=0
 When overridden in a derived class, writes out the given white space. More...
 
virtual void WriteString (const String &text)=0
 When overridden in a derived class, writes the given text content. More...
 
virtual void WriteSurrogateCharEntity (char16_t lowChar, char16_t highChar)=0
 When overridden in a derived class, generates and writes the surrogate character entity for the surrogate character pair. More...
 
virtual void WriteChars (ArrayPtr< char16_t > buffer, int32_t index, int32_t count)=0
 When overridden in a derived class, writes text one buffer at a time. More...
 
virtual void WriteRaw (ArrayPtr< char16_t > buffer, int32_t index, int32_t count)=0
 When overridden in a derived class, writes raw markup manually from a character buffer. More...
 
virtual void WriteRaw (const String &data)=0
 When overridden in a derived class, writes raw markup manually from a string. More...
 
virtual void WriteBase64 (ArrayPtr< uint8_t > buffer, int32_t index, int32_t count)=0
 When overridden in a derived class, encodes the specified binary bytes as Base64 and writes out the resulting text. More...
 
virtual void WriteBinHex (ArrayPtr< uint8_t > buffer, int32_t index, int32_t count)
 When overridden in a derived class, encodes the specified binary bytes as BinHex and writes out the resulting text. More...
 
virtual void Close ()
 When overridden in a derived class, closes this stream and the underlying stream. More...
 
virtual void Flush ()=0
 When overridden in a derived class, flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream. More...
 
virtual String LookupPrefix (String ns)=0
 When overridden in a derived class, returns the closest prefix defined in the current namespace scope for the namespace URI. More...
 
virtual void WriteNmToken (const String &name)
 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). More...
 
virtual void WriteName (const String &name)
 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). More...
 
virtual void WriteQualifiedName (const String &localName, const String &ns)
 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. More...
 
virtual void WriteValue (SharedPtr< Object > value)
 Writes the object value. More...
 
virtual void WriteValue (const String &value)
 Writes a String value. More...
 
virtual void WriteValue (bool value)
 Writes a Boolean value. More...
 
virtual void WriteValue (DateTime value)
 Writes a DateTime value. More...
 
virtual void WriteValue (DateTimeOffset value)
 Writes a DateTimeOffset value. More...
 
virtual void WriteValue (double value)
 Writes a Double value. More...
 
virtual void WriteValue (float value)
 Writes a single-precision floating-point number. More...
 
virtual void WriteValue (Decimal value)
 Writes a Decimal value. More...
 
virtual void WriteValue (int32_t value)
 Writes a Int32 value. More...
 
virtual void WriteValue (int64_t value)
 Writes a Int64 value. More...
 
virtual void WriteAttributes (SharedPtr< XmlReader > reader, bool defattr)
 When overridden in a derived class, writes out all the attributes found at the current position in the XmlReader. More...
 
virtual void WriteNode (SharedPtr< XmlReader > reader, bool defattr)
 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. More...
 
virtual void WriteNode (SharedPtr< XPath::XPathNavigator > navigator, bool defattr)
 Copies everything from the XPathNavigator object to the writer. The position of the XPathNavigator remains unchanged. More...
 
void WriteElementString (const String &localName, const String &value)
 Writes an element with the specified local name and value. More...
 
void WriteElementString (const String &localName, const String &ns, const String &value)
 Writes an element with the specified local name, namespace URI, and value. More...
 
void WriteElementString (const String &prefix, const String &localName, const String &ns, const String &value)
 Writes an element with the specified prefix, local name, namespace URI, and value. More...
 
void Dispose () override
 Releases all resources used by the current instance of the XmlWriter class. More...
 
virtual void Dispose ()
 Does nothing. More...
 
- Public Member Functions inherited from System::Object
 Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ~Object ()
 Destroys object. Frees all internal data structures. More...
 
 Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared reference counter. More...
 
void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual int32_t GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual String ToString () const
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual void SetTemplateWeakPtr (uint32_t argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
virtual bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 For internal purposes only. More...
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 Specialization of Object::ReferenceEquals for case of string and nullptr. More...
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 Specialization of Object::ReferenceEquals for case of strings. More...
 

Protected Member Functions

virtual ~XmlTextWriter ()
 
- Protected Member Functions inherited from System::Xml::XmlWriter
virtual void Dispose (bool disposing)
 Optionally releases all resources used by the current instance of the XmlWriter class. More...
 
virtual ~XmlWriter ()
 

Additional Inherited Members

- Static Public Member Functions inherited from System::Xml::XmlWriter
static SharedPtr< XmlWriterCreate (const String &outputFileName)
 Creates a new XmlWriter instance using the specified filename. More...
 
static SharedPtr< XmlWriterCreate (const String &outputFileName, SharedPtr< XmlWriterSettings > settings)
 Creates a new XmlWriter instance using the filename and XmlWriterSettings object. More...
 
static SharedPtr< XmlWriterCreate (const SharedPtr< IO::Stream > &output)
 Creates a new XmlWriter instance using the specified stream. More...
 
static SharedPtr< XmlWriterCreate (const SharedPtr< IO::Stream > &output, SharedPtr< XmlWriterSettings > settings)
 Creates a new XmlWriter instance using the stream and XmlWriterSettings object. More...
 
static SharedPtr< XmlWriterCreate (const SharedPtr< IO::TextWriter > &output)
 Creates a new XmlWriter instance using the specified TextWriter. More...
 
static SharedPtr< XmlWriterCreate (const SharedPtr< IO::TextWriter > &output, SharedPtr< XmlWriterSettings > settings)
 Creates a new XmlWriter instance using the TextWriter and XmlWriterSettings objects. More...
 
static SharedPtr< XmlWriterCreate (const SharedPtr< Text::StringBuilder > &output)
 Creates a new XmlWriter instance using the specified Text::StringBuilder. More...
 
static SharedPtr< XmlWriterCreate (const SharedPtr< Text::StringBuilder > &output, SharedPtr< XmlWriterSettings > settings)
 Creates a new XmlWriter instance using the Text::StringBuilder and XmlWriterSettings objects. More...
 
static SharedPtr< XmlWriterCreate (const SharedPtr< XmlWriter > &output)
 Creates a new XmlWriter instance using the specified XmlWriter object. More...
 
static SharedPtr< XmlWriterCreate (const SharedPtr< XmlWriter > &output, SharedPtr< XmlWriterSettings > settings)
 Creates a new XmlWriter instance using the specified XmlWriter and XmlWriterSettings objects. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Implements C# typeof(System.Object) construct. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 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. More...
 
template<>
bool Equals (double const &objA, double const &objB)
 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. More...
 

Detailed Description

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.

Remarks
It is recommended to use the XmlWriter class instead.
Attention
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.

Member Typedef Documentation

◆ Ptr

An alias for shared pointer to an instance of this class.

Constructor & Destructor Documentation

◆ XmlTextWriter() [1/3]

System::Xml::XmlTextWriter::XmlTextWriter ( const SharedPtr< IO::Stream > &  w,
const SharedPtr< Text::Encoding > &  encoding 
)

Creates an instance of the XmlTextWriter class using the specified stream and encoding.

Parameters
wThe stream to which you want to write.
encodingThe encoding to generate. If encoding is nullptr it writes out the stream as UTF-8 and omits the encoding attribute from the ProcessingInstruction.
Exceptions
ArgumentExceptionThe encoding is not supported or the stream cannot be written to.
ArgumentNullExceptionw is nullptr.

◆ XmlTextWriter() [2/3]

System::Xml::XmlTextWriter::XmlTextWriter ( const String filename,
const SharedPtr< Text::Encoding > &  encoding 
)

Creates an instance of the XmlTextWriter class using the specified file.

Parameters
filenameThe filename to write to. If the file exists, it truncates it and overwrites it with the new content.
encodingThe encoding to generate. If encoding is nullptr it writes the file out as UTF-8 and omits the encoding attribute from the ProcessingInstruction.
Exceptions
ArgumentExceptionThe encoding is not supported; the filename is empty, contains only white space, or contains one or more invalid characters.
UnauthorizedAccessExceptionAccess is denied.
ArgumentNullExceptionThe filename is nullptr.
DirectoryNotFoundExceptionThe directory to write to is not found.
IOExceptionThe filename includes an incorrect or invalid syntax for file name, directory name, or volume label syntax.
SecurityExceptionThe caller does not have the required permission.

◆ XmlTextWriter() [3/3]

System::Xml::XmlTextWriter::XmlTextWriter ( const SharedPtr< IO::TextWriter > &  w)

Creates an instance of the XmlTextWriter class using the specified TextWriter.

Parameters
wThe TextWriter to write to. It is assumed that the TextWriter is already set to the correct encoding.

◆ ~XmlTextWriter()

virtual System::Xml::XmlTextWriter::~XmlTextWriter ( )
protectedvirtual

Member Function Documentation

◆ Close()

void System::Xml::XmlTextWriter::Close ( )
overridevirtual

Closes this stream and the underlying stream.

Reimplemented from System::Xml::XmlWriter.

◆ Flush()

void System::Xml::XmlTextWriter::Flush ( )
overridevirtual

Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.

Implements System::Xml::XmlWriter.

◆ get_BaseStream()

SharedPtr< IO::Stream > System::Xml::XmlTextWriter::get_BaseStream ( )

Returns the underlying stream object.

Returns
The stream to which the XmlTextWriter is writing or nullptr if the XmlTextWriter was constructed using a TextWriter that does not inherit from the StreamWriter class.

◆ get_Formatting()

System::Xml::Formatting System::Xml::XmlTextWriter::get_Formatting ( )

Indicates how the output is formatted.

Returns
One of the Formatting values. The default is Formatting::None (no special formatting).

◆ get_Indentation()

int32_t System::Xml::XmlTextWriter::get_Indentation ( )

Returns how many IndentChars to write for each level in the hierarchy when XmlTextWriter::set_Formatting is set to Formatting::Indented.

Returns
Number of IndentChars for each level. The default is 2.

◆ get_IndentChar()

char16_t System::Xml::XmlTextWriter::get_IndentChar ( )

Returns which character to use for indenting when XmlTextWriter::set_Formatting is set to Formatting::Indented.

Returns
The character to use for indenting. The default is space.

◆ get_Namespaces()

bool System::Xml::XmlTextWriter::get_Namespaces ( )

Returns a value indicating whether to do namespace support.

Returns
true to support namespaces; otherwise, false. The default is true.

◆ get_QuoteChar()

char16_t System::Xml::XmlTextWriter::get_QuoteChar ( )

Returns which character to use to quote attribute values.

Returns
The character to use to quote attribute values. This must be a single quote ' or a double quote ". The default is a double quote.

◆ get_WriteState()

System::Xml::WriteState System::Xml::XmlTextWriter::get_WriteState ( )
overridevirtual

Returns the state of the writer.

Returns
One of the WriteState values.

Implements System::Xml::XmlWriter.

◆ get_XmlLang()

String System::Xml::XmlTextWriter::get_XmlLang ( )
overridevirtual

Returns the current xml:lang scope.

Returns
The current xml:lang or nullptr if there is no xml:lang in the current scope.

Reimplemented from System::Xml::XmlWriter.

◆ get_XmlSpace()

System::Xml::XmlSpace System::Xml::XmlTextWriter::get_XmlSpace ( )
overridevirtual

Returns an XmlSpace representing the current xml:space scope.

Returns
An XmlSpace representing the current xml:space scope.
Value Meaning
None This is the default if no xml:space scope exists.
Default The current scope is xml:space="default".
Preserve The current scope is xml:space="preserve".

Reimplemented from System::Xml::XmlWriter.

◆ LookupPrefix()

String System::Xml::XmlTextWriter::LookupPrefix ( String  ns)
overridevirtual

Returns the closest prefix defined in the current namespace scope for the namespace URI.

Parameters
nsNamespace URI whose prefix you want to find.
Returns
The matching prefix. Or nullptr if no matching namespace URI is found in the current scope.
Exceptions
ArgumentExceptionns is either nullptr or String::Empty.

Implements System::Xml::XmlWriter.

◆ set_Formatting()

void System::Xml::XmlTextWriter::set_Formatting ( System::Xml::Formatting  value)

Indicates how the output is formatted.

Parameters
valueThe value to set.

◆ set_Indentation()

void System::Xml::XmlTextWriter::set_Indentation ( int32_t  value)

Sets how many IndentChars to write for each level in the hierarchy when XmlTextWriter::set_Formatting is set to Formatting::Indented.

Parameters
valueThe value to set.
Exceptions
ArgumentExceptionSetting value to a negative value.

◆ set_IndentChar()

void System::Xml::XmlTextWriter::set_IndentChar ( char16_t  value)

Sets which character to use for indenting when XmlTextWriter::set_Formatting is set to Formatting::Indented.

Parameters
valueThe value to set.

◆ set_Namespaces()

void System::Xml::XmlTextWriter::set_Namespaces ( bool  value)

Sets a value indicating whether to do namespace support.

Parameters
valueThe value to set.
Exceptions
InvalidOperationExceptionYou can only change this value when in the WriteState::Start state.

◆ set_QuoteChar()

void System::Xml::XmlTextWriter::set_QuoteChar ( char16_t  value)

Sets which character to use to quote attribute values.

Parameters
valueThe value to set.
Exceptions
ArgumentExceptionSetting this value to something other than either a single or double quote.

◆ WriteBase64()

void System::Xml::XmlTextWriter::WriteBase64 ( ArrayPtr< uint8_t >  buffer,
int32_t  index,
int32_t  count 
)
overridevirtual

Encodes the specified binary bytes as base64 and writes out the resulting text.

Parameters
bufferByte array to encode.
indexThe position within the buffer indicating the start of the bytes to write.
countThe number of bytes to write.
Exceptions
ArgumentNullExceptionbuffer is nullptr.
ArgumentExceptionThe buffer length minus index is less than count.
ArgumentOutOfRangeExceptionindex or count is less than zero.
InvalidOperationExceptionThe XmlTextWriter::get_WriteState value is WriteState::Closed.

Implements System::Xml::XmlWriter.

◆ WriteBinHex()

void System::Xml::XmlTextWriter::WriteBinHex ( ArrayPtr< uint8_t >  buffer,
int32_t  index,
int32_t  count 
)
overridevirtual

Encodes the specified binary bytes as binhex and writes out the resulting text.

Parameters
bufferByte array to encode.
indexThe position in the buffer indicating the start of the bytes to write.
countThe number of bytes to write.
Exceptions
ArgumentNullExceptionbuffer is nullptr.
ArgumentExceptionThe buffer length minus index is less than count.
ArgumentOutOfRangeExceptionindex or count is less than zero.
InvalidOperationExceptionThe XmlTextWriter::get_WriteState value is WriteState::Closed.

Reimplemented from System::Xml::XmlWriter.

◆ WriteCData()

void System::Xml::XmlTextWriter::WriteCData ( String  text)
overridevirtual

Writes out a ... block containing the specified text.

Parameters
textText to place inside the CDATA block.
Exceptions
ArgumentExceptionThe text would result in a non-well formed XML document.
InvalidOperationExceptionThe XmlTextWriter::get_WriteState value is WriteState::Closed.

Implements System::Xml::XmlWriter.

◆ WriteCharEntity()

void System::Xml::XmlTextWriter::WriteCharEntity ( char16_t  ch)
overridevirtual

Forces the generation of a character entity for the specified Unicode character value.

Parameters
chUnicode character for which to generate a character entity.
Exceptions
ArgumentExceptionThe character is in the surrogate pair character range, 0xd800 - 0xdfff; or the text would result in a non-well formed XML document.
InvalidOperationExceptionThe XmlTextWriter::get_WriteState value is WriteState::Closed.

Implements System::Xml::XmlWriter.

◆ WriteChars()

void System::Xml::XmlTextWriter::WriteChars ( ArrayPtr< char16_t >  buffer,
int32_t  index,
int32_t  count 
)
overridevirtual

Writes text one buffer at a time.

Parameters
bufferCharacter array containing the text to write.
indexThe position in the buffer indicating the start of the text to write.
countThe number of characters to write.
Exceptions
ArgumentNullExceptionbuffer is nullptr.
ArgumentOutOfRangeExceptionindex or count is less than zero. The buffer length minus index is less than count; the call results in surrogate pair characters being split or an invalid surrogate pair being written.
InvalidOperationExceptionThe XmlTextWriter::get_WriteState value is WriteState::Closed.

Implements System::Xml::XmlWriter.

◆ WriteComment()

void System::Xml::XmlTextWriter::WriteComment ( String  text)
overridevirtual

Writes out a comment containing the specified text.

Parameters
textText to place inside the comment.
Exceptions
ArgumentExceptionThe text would result in a non-well formed XML document.
InvalidOperationExceptionThe XmlTextWriter::get_WriteState value is WriteState::Closed.

Implements System::Xml::XmlWriter.

◆ WriteDocType()

void System::Xml::XmlTextWriter::WriteDocType ( const String name,
const String pubid,
const String sysid,
const String subset 
)
overridevirtual

Writes the DOCTYPE declaration with the specified name and optional attributes.

Parameters
nameThe name of the DOCTYPE. This must be non-empty.
pubidIf non-null it also writes PUBLIC "pubid" "sysid" where pubid and sysid are replaced with the value of the given arguments.
sysidIf pubid is null and sysid is non-null it writes SYSTEM "sysid" where sysid is replaced with the value of this argument.
subsetIf non-null it writes [subset] where subset is replaced with the value of this argument.
Exceptions
InvalidOperationExceptionThis method was called outside the prolog (after the root element).
ArgumentExceptionname is nullptr or String::Empty or the value for name would result in invalid XML.

Implements System::Xml::XmlWriter.

◆ WriteEndAttribute()

void System::Xml::XmlTextWriter::WriteEndAttribute ( )
overridevirtual

Closes the previous XmlTextWriter::WriteStartAttribute call.

Implements System::Xml::XmlWriter.

◆ WriteEndDocument()

void System::Xml::XmlTextWriter::WriteEndDocument ( )
overridevirtual

Closes any open elements or attributes and puts the writer back in the Start state.

Exceptions
ArgumentExceptionThe XML document is invalid.

Implements System::Xml::XmlWriter.

◆ WriteEndElement()

void System::Xml::XmlTextWriter::WriteEndElement ( )
overridevirtual

Closes one element and pops the corresponding namespace scope.

Implements System::Xml::XmlWriter.

◆ WriteEntityRef()

void System::Xml::XmlTextWriter::WriteEntityRef ( const String name)
overridevirtual

Writes out an entity reference as &name;.

Parameters
nameName of the entity reference.
Exceptions
ArgumentExceptionThe text would result in a non-well formed XML document or name is either nullptr or String::Empty.

Implements System::Xml::XmlWriter.

◆ WriteFullEndElement()

void System::Xml::XmlTextWriter::WriteFullEndElement ( )
overridevirtual

Closes one element and pops the corresponding namespace scope.

Implements System::Xml::XmlWriter.

◆ WriteName()

void System::Xml::XmlTextWriter::WriteName ( const String name)
overridevirtual

Writes out the specified name, ensuring it is a valid name according to the W3C XML 1.0 recommendation.

Parameters
nameName to write.
Exceptions
ArgumentExceptionname is not a valid XML name; or name is either nullptr or String::Empty.

Reimplemented from System::Xml::XmlWriter.

◆ WriteNmToken()

void System::Xml::XmlTextWriter::WriteNmToken ( const String name)
overridevirtual

Writes out the specified name, ensuring it is a valid NmToken according to the W3C XML 1.0 recommendation.

Parameters
nameName to write.
Exceptions
ArgumentExceptionname is not a valid NmToken; or name is either nullptr or String::Empty.

Reimplemented from System::Xml::XmlWriter.

◆ WriteProcessingInstruction()

void System::Xml::XmlTextWriter::WriteProcessingInstruction ( String  name,
String  text 
)
overridevirtual

Writes out a processing instruction with a space between the name and text as follows: <?name text?>.

Parameters
nameName of the processing instruction.
textText to include in the processing instruction.
Exceptions
ArgumentExceptionThe text would result in a non-well formed XML document. name is either nullptr or String::Empty.

This method is being used to create an XML declaration after XmlTextWriter::WriteStartDocument has already been called.

Implements System::Xml::XmlWriter.

◆ WriteQualifiedName()

void System::Xml::XmlTextWriter::WriteQualifiedName ( const String localName,
const String ns 
)
overridevirtual

Writes out the namespace-qualified name. This method looks up the prefix that is in scope for the given namespace.

Parameters
localNameThe local name to write.
nsThe namespace URI to associate with the name.
Exceptions
ArgumentExceptionlocalName is either nullptr or String::Empty. localName is not a valid name according to the W3C Namespaces spec.

Reimplemented from System::Xml::XmlWriter.

◆ WriteRaw() [1/2]

void System::Xml::XmlTextWriter::WriteRaw ( ArrayPtr< char16_t >  buffer,
int32_t  index,
int32_t  count 
)
overridevirtual

Writes raw markup manually from a character buffer.

Parameters
bufferCharacter array containing the text to write.
indexThe position within the buffer indicating the start of the text to write.
countThe number of characters to write.
Exceptions
ArgumentNullExceptionbuffer is nullptr.
ArgumentOutOfRangeExceptionindex or count is less than zero. The buffer length minus index is less than count.

Implements System::Xml::XmlWriter.

◆ WriteRaw() [2/2]

void System::Xml::XmlTextWriter::WriteRaw ( const String data)
overridevirtual

Writes raw markup manually from a string.

Parameters
dataString containing the text to write.

Implements System::Xml::XmlWriter.

◆ WriteStartAttribute()

void System::Xml::XmlTextWriter::WriteStartAttribute ( const String prefix,
const String localName,
const String ns 
)
overridevirtual

Writes the start of an attribute.

Parameters
prefixNamespace prefix of the attribute.
localNameLocalName of the attribute.
nsNamespaceURI of the attribute.
Exceptions
ArgumentExceptionlocalName is either nullptr or String::Empty.

Implements System::Xml::XmlWriter.

◆ WriteStartDocument() [1/2]

void System::Xml::XmlTextWriter::WriteStartDocument ( )
overridevirtual

Writes the XML declaration with the version "1.0".

Exceptions
InvalidOperationExceptionThis is not the first write method called after the constructor.

Implements System::Xml::XmlWriter.

◆ WriteStartDocument() [2/2]

void System::Xml::XmlTextWriter::WriteStartDocument ( bool  standalone)
overridevirtual

Writes the XML declaration with the version "1.0" and the standalone attribute.

Parameters
standaloneIf true, it writes "standalone=yes"; if false, it writes "standalone=no".
Exceptions
InvalidOperationExceptionThis is not the first write method called after the constructor.

Implements System::Xml::XmlWriter.

◆ WriteStartElement()

void System::Xml::XmlTextWriter::WriteStartElement ( const String prefix,
const String localName,
const String ns 
)
overridevirtual

Writes the specified start tag and associates it with the given namespace and prefix.

Parameters
prefixThe namespace prefix of the element.
localNameThe local name of the element.
nsThe namespace URI to associate with the element. If this namespace is already in scope and has an associated prefix then the writer automatically writes that prefix also.
Exceptions
InvalidOperationExceptionThe writer is closed.

Implements System::Xml::XmlWriter.

◆ WriteString()

void System::Xml::XmlTextWriter::WriteString ( const String text)
overridevirtual

Writes the given text content.

Parameters
textText to write.
Exceptions
ArgumentExceptionThe text string contains an invalid surrogate pair.

Implements System::Xml::XmlWriter.

◆ WriteSurrogateCharEntity()

void System::Xml::XmlTextWriter::WriteSurrogateCharEntity ( char16_t  lowChar,
char16_t  highChar 
)
overridevirtual

Generates and writes the surrogate character entity for the surrogate character pair.

Parameters
lowCharThe low surrogate. This must be a value between 0xDC00 and 0xDFFF.
highCharThe high surrogate. This must be a value between 0xD800 and 0xDBFF.
Exceptions
ExceptionAn invalid surrogate character pair was passed.

Implements System::Xml::XmlWriter.

◆ WriteWhitespace()

void System::Xml::XmlTextWriter::WriteWhitespace ( String  ws)
overridevirtual

Writes out the given white space.

Parameters
wsThe string of white space characters.
Exceptions
ArgumentExceptionThe string contains non-white space characters.

Implements System::Xml::XmlWriter.