XmlTextReader

XmlTextReader class

Represents a reader that provides fast, non-cached, forward-only access to XML data.

class XmlTextReader : public System::Xml::XmlReader,
                      public System::Xml::IXmlLineInfo,
                      public System::Xml::IXmlNamespaceResolver

Methods

MethodDescription
void Close() overrideChanges the XmlReader::get_ReadState to Closed.
static SharedPtr<XmlReader> Create(const String&)Creates a new XmlReader instance with specified URI.
static SharedPtr<XmlReader> Create(const String&, const SharedPtr<XmlReaderSettings>&)Creates a new XmlReader instance by using the specified URI and settings.
static SharedPtr<XmlReader> Create(const String&, SharedPtr<XmlReaderSettings>, const SharedPtr<XmlParserContext>&)Creates a new XmlReader instance by using the specified URI, settings, and context information for parsing.
static SharedPtr<XmlReader> Create(const SharedPtr<IO::Stream>&)Creates a new XmlReader instance using the specified stream with default settings.
static SharedPtr<XmlReader> Create(const SharedPtr<IO::Stream>&, const SharedPtr<XmlReaderSettings>&)Creates a new XmlReader instance with the specified stream and settings.
static SharedPtr<XmlReader> Create(const SharedPtr<IO::Stream>&, SharedPtr<XmlReaderSettings>, const String&)Creates a new XmlReader instance using the specified stream, base URI, and settings.
static SharedPtr<XmlReader> Create(const SharedPtr<IO::Stream>&, SharedPtr<XmlReaderSettings>, const SharedPtr<XmlParserContext>&)Creates a new XmlReader instance using the specified stream, settings, and context information for parsing.
static SharedPtr<XmlReader> Create(const SharedPtr<IO::TextReader>&)Creates a new XmlReader instance by using the specified text reader.
static SharedPtr<XmlReader> Create(const SharedPtr<IO::TextReader>&, const SharedPtr<XmlReaderSettings>&)Creates a new XmlReader instance by using the specified text reader and settings.
static SharedPtr<XmlReader> Create(const SharedPtr<IO::TextReader>&, SharedPtr<XmlReaderSettings>, const String&)Creates a new XmlReader instance by using the specified text reader, settings, and base URI.
static SharedPtr<XmlReader> Create(const SharedPtr<IO::TextReader>&, SharedPtr<XmlReaderSettings>, const SharedPtr<XmlParserContext>&)Creates a new XmlReader instance by using the specified text reader, settings, and context information for parsing.
static SharedPtr<XmlReader> Create(const SharedPtr<XmlReader>&, SharedPtr<XmlReaderSettings>)Creates a new XmlReader instance by using the specified XML reader and settings.
void Dispose() overrideReleases all resources used by the current instance of the XmlReader 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.
int32_t get_AttributeCount() overrideReturns the number of attributes on the current node.
String get_BaseURI() overrideReturns the base URI of the current node.
bool get_CanReadBinaryContent() overrideReturns a value indicating whether the XmlTextReader implements the binary content read methods.
bool get_CanReadValueChunk() overrideReturns a value indicating whether the XmlTextReader implements the XmlReader::ReadValueChunk method.
bool get_CanResolveEntity() overrideReturns a value indicating whether this reader can parse and resolve entities.
int32_t get_Depth() overrideReturns the depth of the current node in the XML document.
System::Xml::DtdProcessing get_DtdProcessing()Returns the DtdProcessing enumeration.
SharedPtr<System::Text::Encoding> get_Encoding()Returns the encoding of the document.
System::Xml::EntityHandling get_EntityHandling()Returns a value that specifies how the reader handles entities.
bool get_EOF() overrideReturns a value indicating whether the reader is positioned at the end of the stream.
virtual bool get_HasAttributes()Returns a value indicating whether the current node has any attributes.
bool get_HasValue() overrideReturns a value indicating whether the current node can have a XmlTextReader::get_Value other than String::Empty.
bool get_IsDefault() overrideReturns a value indicating whether the current node is an attribute that was generated from the default value defined in the DTD or schema.
bool get_IsEmptyElement() overrideReturns a value indicating whether the current node is an empty element (for example, ).
int32_t get_LineNumber() overrideReturns the current line number.
int32_t get_LinePosition() overrideReturns the current line position.
String get_LocalName() overrideReturns the local name of the current node.
String get_Name() overrideReturns the qualified name of the current node.
bool get_Namespaces()Returns a value indicating whether to do namespace support.
String get_NamespaceURI() overrideReturns the namespace URI (as defined in the W3C Namespace specification) of the node on which the reader is positioned.
SharedPtr<XmlNameTable> get_NameTable() overrideReturns the XmlNameTable associated with this implementation.
XmlNodeType get_NodeType() overrideReturns the type of the current node.
bool get_Normalization()Returns a value indicating whether to normalize white space and attribute values.
String get_Prefix() overrideReturns the namespace prefix associated with the current node.
bool get_ProhibitDtd()Returns a value indicating whether to allow DTD processing.
char16_t get_QuoteChar() overrideReturns the quotation mark character used to enclose the value of an attribute node.
System::Xml::ReadState get_ReadState() overrideReturns the state of the reader.
virtual SharedPtr<Schema::IXmlSchemaInfo> get_SchemaInfo()Returns the schema information that has been assigned to the current node as a result of schema validation.
virtual SharedPtr<XmlReaderSettings> get_Settings()Returns the XmlReaderSettings object used to create this XmlReader instance.
String get_Value() overrideReturns the text value of the current node.
virtual TypeInfo get_ValueType()Returns The type for the current node.
System::Xml::WhitespaceHandling get_WhitespaceHandling()Returns a value that specifies how white space is handled.
String get_XmlLang() overrideReturns the current xml:lang scope.
System::Xml::XmlSpace get_XmlSpace() overrideReturns the current xml:space scope.
String GetAttribute(String) overrideReturns the value of the attribute with the specified name.
String GetAttribute(String, String) overrideReturns the value of the attribute with the specified local name and namespace URI.
String GetAttribute(int32_t) overrideReturns the value of the attribute with the specified index.
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.
SharedPtr<Collections::Generic::IDictionary<String, String>> GetNamespacesInScope(XmlNamespaceScope) overrideReturns a collection that contains all namespaces currently in-scope.
SharedPtr<IO::TextReader> GetRemainder()Returns the remainder of the buffered XML.
virtual const TypeInfo& GetType() constGets actual type of object. Analog of C# System.Object.GetType() call.
bool HasLineInfo() overrideReturns a value indicating whether the class can return line information.
virtual String idx_get(int32_t)When overridden in a derived class, gets the value of the attribute with the specified index.
virtual String idx_get(String)When overridden in a derived class, gets the value of the attribute with the specified XmlReader::get_Name value.
virtual String idx_get(String, String)When overridden in a derived class, gets the value of the attribute with the specified XmlReader::get_LocalName and XmlReader::get_NamespaceURI values.
virtual bool Is(const TypeInfo&) constCheck if object represents an instance of type described by targetType. Analog of C# ‘is’ operator.
static bool IsName(const String&)Returns a value indicating whether the string argument is a valid XML name.
static bool IsNameToken(const String&)Returns a value indicating whether or not the string argument is a valid XML name token.
virtual bool IsStartElement()Calls XmlReader::MoveToContent and tests if the current content node is a start tag or empty element tag.
virtual bool IsStartElement(String)Calls XmlReader::MoveToContent and tests if the current content node is a start tag or empty element tag and if the XmlReader::get_Name value of the element found matches the given argument.
virtual bool IsStartElement(String, String)Calls XmlReader::MoveToContent and tests if the current content node is a start tag or empty element tag and if the XmlReader::get_LocalName and XmlReader::get_NamespaceURI values of the element found match the given strings.
void Lock()Implements C# lock() statement locking. Call directly or use LockContext sentry object.
String LookupNamespace(const String&) overrideResolves a namespace prefix in the current element’s scope.
virtual ptr MemberwiseClone() constAnalog of C# Object.MemberwiseClone() method. Enables cloning custom types.
bool MoveToAttribute(String) overrideMoves to the attribute with the specified name.
bool MoveToAttribute(String, String) overrideMoves to the attribute with the specified local name and namespace URI.
void MoveToAttribute(int32_t) overrideMoves to the attribute with the specified index.
virtual XmlNodeType MoveToContent()Checks whether the current node is a content (non-white space text, CDATA, Element, EndElement, EntityReference, or EndEntity) node. If the node is not a content node, the reader skips ahead to the next content node or end of file. It skips over nodes of the following type: ProcessingInstruction, DocumentType, Comment, Whitespace, or SignificantWhitespace.
bool MoveToElement() overrideMoves to the element that contains the current attribute node.
bool MoveToFirstAttribute() overrideMoves to the first attribute.
bool MoveToNextAttribute() overrideMoves to the next attribute.
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.
bool Read() overrideReads the next node from the stream.
bool ReadAttributeValue() overrideParses the attribute value into one or more Text, EntityReference, or EndEntity nodes.
int32_t ReadBase64(const ArrayPtr<uint8_t>&, int32_t, int32_t)Decodes Base64 and returns the decoded binary bytes.
int32_t ReadBinHex(const ArrayPtr<uint8_t>&, int32_t, int32_t)Decodes BinHex and returns the decoded binary bytes.
int32_t ReadChars(const ArrayPtr<char16_t>&, int32_t, int32_t)Reads the text contents of an element into a character buffer. This method is designed to read large streams of embedded text by calling it successively.
virtual SharedPtr<Object> ReadContentAs(const TypeInfo&, SharedPtr<IXmlNamespaceResolver>)Reads the content as an object of the type specified.
int32_t ReadContentAsBase64(ArrayPtr<uint8_t>, int32_t, int32_t) overrideReads the content and returns the Base64 decoded binary bytes.
int32_t ReadContentAsBinHex(ArrayPtr<uint8_t>, int32_t, int32_t) overrideReads the content and returns the BinHex decoded binary bytes.
virtual bool ReadContentAsBoolean()Reads the text content at the current position as a Boolean.
virtual DateTime ReadContentAsDateTime()Reads the text content at the current position as a DateTime object.
virtual DateTimeOffset ReadContentAsDateTimeOffset()Reads the text content at the current position as a DateTimeOffset object.
virtual Decimal ReadContentAsDecimal()Reads the text content at the current position as a Decimal object.
virtual double ReadContentAsDouble()Reads the text content at the current position as a double-precision floating-point number.
virtual float ReadContentAsFloat()Reads the text content at the current position as a single-precision floating point number.
virtual int32_t ReadContentAsInt()Reads the text content at the current position as a 32-bit signed integer.
virtual int64_t ReadContentAsLong()Reads the text content at the current position as a 64-bit signed integer.
virtual SharedPtr<Object> ReadContentAsObject()Reads the text content at the current position as an Object.
virtual String ReadContentAsString()Reads the text content at the current position as a String object.
virtual SharedPtr<Object> ReadElementContentAs(const TypeInfo&, SharedPtr<IXmlNamespaceResolver>)Reads the element content as the requested type.
virtual SharedPtr<Object> ReadElementContentAs(const TypeInfo&, SharedPtr<IXmlNamespaceResolver>, String, String)Checks that the specified local name and namespace URI matches that of the current element, then reads the element content as the requested type.
int32_t ReadElementContentAsBase64(ArrayPtr<uint8_t>, int32_t, int32_t) overrideReads the element and decodes the Base64 content.
int32_t ReadElementContentAsBinHex(ArrayPtr<uint8_t>, int32_t, int32_t) overrideReads the element and decodes the BinHex content.
virtual bool ReadElementContentAsBoolean()Reads the current element and returns the contents as a Boolean object.
virtual bool ReadElementContentAsBoolean(String, String)Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a Boolean object.
virtual DateTime ReadElementContentAsDateTime()Reads the current element and returns the contents as a DateTime object.
virtual DateTime ReadElementContentAsDateTime(String, String)Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a DateTime object.
virtual Decimal ReadElementContentAsDecimal()Reads the current element and returns the contents as a Decimal object.
virtual Decimal ReadElementContentAsDecimal(String, String)Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a Decimal object.
virtual double ReadElementContentAsDouble()Reads the current element and returns the contents as a double-precision floating-point number.
virtual double ReadElementContentAsDouble(String, String)Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a double-precision floating-point number.
virtual float ReadElementContentAsFloat()Reads the current element and returns the contents as single-precision floating-point number.
virtual float ReadElementContentAsFloat(String, String)Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a single-precision floating-point number.
virtual int32_t ReadElementContentAsInt()Reads the current element and returns the contents as a 32-bit signed integer.
virtual int32_t ReadElementContentAsInt(String, String)Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a 32-bit signed integer.
virtual int64_t ReadElementContentAsLong()Reads the current element and returns the contents as a 64-bit signed integer.
virtual int64_t ReadElementContentAsLong(String, String)Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a 64-bit signed integer.
virtual SharedPtr<Object> ReadElementContentAsObject()Reads the current element and returns the contents as an Object.
virtual SharedPtr<Object> ReadElementContentAsObject(String, String)Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as an Object.
virtual String ReadElementContentAsString()Reads the current element and returns the contents as a String object.
virtual String ReadElementContentAsString(String, String)Checks that the specified local name and namespace URI matches that of the current element, then reads the current element and returns the contents as a String object.
virtual String ReadElementString()Reads a text-only element. However, it is recommended to use the XmlReader::ReadElementContentAsString method instead, because it provides a more straightforward way to handle this operation.
virtual String ReadElementString(String)Checks that the XmlReader::get_Name value of the element found matches the given string before reading a text-only element. However, it is recommended to use the XmlReader::ReadElementContentAsString method instead, because it provides a more straightforward way to handle this operation.
virtual String ReadElementString(String, String)Checks that the XmlReader::get_LocalName and XmlReader::get_NamespaceURI values of the element found matches the given strings before reading a text-only element. However, it is recommended to use the XmlReader::ReadElementContentAsString method instead, because it provides a more straightforward way to handle this operation.
virtual void ReadEndElement()Checks that the current content node is an end tag and advances the reader to the next node.
virtual String ReadInnerXml()When overridden in a derived class, reads all the content, including markup, as a string.
virtual String ReadOuterXml()When overridden in a derived class, reads the content, including markup, representing this node and all its children.
virtual void ReadStartElement()Checks that the current node is an element and advances the reader to the next node.
virtual void ReadStartElement(String)Checks that the current content node is an element with the given XmlReader::get_Name value and advances the reader to the next node.
virtual void ReadStartElement(String, String)Checks that the current content node is an element with the given XmlReader::get_LocalName and XmlReader::get_NamespaceURI values and advances the reader to the next node.
String ReadString() overrideReads the contents of an element or a text node as a string.
virtual SharedPtr<XmlReader> ReadSubtree()Returns a new XmlReader instance that can be used to read the current node, and all its descendants.
virtual bool ReadToDescendant(String)Advances the XmlReader to the next descendant element with the specified qualified name.
virtual bool ReadToDescendant(String, String)Advances the XmlReader to the next descendant element with the specified local name and namespace URI.
virtual bool ReadToFollowing(String)Reads until an element with the specified qualified name is found.
virtual bool ReadToFollowing(String, String)Reads until an element with the specified local name and namespace URI is found.
virtual bool ReadToNextSibling(String)Advances the XmlReader to the next sibling element with the specified qualified name.
virtual bool ReadToNextSibling(String, String)Advances the XmlReader to the next sibling element with the specified local name and namespace URI.
virtual int32_t ReadValueChunk(ArrayPtr<char16_t>, int32_t, int32_t)Reads large streams of text embedded in an XML document.
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 ResetState()Resets the state of the reader to ReadState::Initial.
void ResolveEntity() overrideResolves the entity reference for EntityReference nodes.
void set_DtdProcessing(System::Xml::DtdProcessing)Sets the DtdProcessing enumeration.
void set_EntityHandling(System::Xml::EntityHandling)Sets a value that specifies how the reader handles entities.
void set_Namespaces(bool)Sets a value indicating whether to do namespace support.
void set_Normalization(bool)Sets a value indicating whether to normalize white space and attribute values.
void set_ProhibitDtd(bool)Sets a value indicating whether to allow DTD processing.
void set_WhitespaceHandling(System::Xml::WhitespaceHandling)Sets a value that specifies how white space is handled.
void set_XmlResolver(const SharedPtr<System::Xml::XmlResolver>&)Sets the XmlResolver used for resolving DTD references.
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.
void Skip() overrideSkips the children of the current node.
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.
XmlTextReader(const SharedPtr<IO::Stream>&)Initializes a new instance of the XmlTextReader class with the specified stream.
XmlTextReader(const String&, const SharedPtr<IO::Stream>&)Initializes a new instance of the XmlTextReader class with the specified URL and stream.
XmlTextReader(const SharedPtr<IO::Stream>&, const SharedPtr<XmlNameTable>&)Initializes a new instance of the XmlTextReader class with the specified stream and XmlNameTable.
XmlTextReader(const String&, const SharedPtr<IO::Stream>&, const SharedPtr<XmlNameTable>&)Initializes a new instance of the XmlTextReader class with the specified URL, stream and XmlNameTable.
XmlTextReader(const SharedPtr<IO::TextReader>&)Initializes a new instance of the XmlTextReader class with the specified TextReader.
XmlTextReader(const String&, const SharedPtr<IO::TextReader>&)Initializes a new instance of the XmlTextReader class with the specified URL and TextReader.
XmlTextReader(const SharedPtr<IO::TextReader>&, const SharedPtr<XmlNameTable>&)Initializes a new instance of the XmlTextReader class with the specified TextReader and XmlNameTable.
XmlTextReader(const String&, const SharedPtr<IO::TextReader>&, const SharedPtr<XmlNameTable>&)Initializes a new instance of the XmlTextReader class with the specified URL, TextReader and XmlNameTable.
XmlTextReader(const SharedPtr<IO::Stream>&, XmlNodeType, const SharedPtr<XmlParserContext>&)Initializes a new instance of the XmlTextReader class with the specified stream, XmlNodeType, and XmlParserContext.
XmlTextReader(const String&, XmlNodeType, const SharedPtr<XmlParserContext>&)Initializes a new instance of the XmlTextReader class with the specified string, XmlNodeType, and XmlParserContext.
XmlTextReader(const String&)Initializes a new instance of the XmlTextReader class with the specified file.
XmlTextReader(const String&, const SharedPtr<XmlNameTable>&)Initializes a new instance of the XmlTextReader class with the specified file and XmlNameTable.
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 XmlReader 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