XmlReader

XmlReader class

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

class XmlReader : public System::IDisposable

Methods

MethodDescription
virtual void Close()When overridden in a derived class, changes the XmlReader::get_ReadState to ReadState::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.
virtual int32_t get_AttributeCount()When overridden in a derived class, gets the number of attributes on the current node.
virtual String get_BaseURI()When overridden in a derived class, gets the base URI of the current node.
virtual bool get_CanReadBinaryContent()Returns a value indicating whether the XmlReader implements the binary content read methods.
virtual bool get_CanReadValueChunk()Returns a value indicating whether the XmlReader implements the XmlReader::ReadValueChunk method.
virtual bool get_CanResolveEntity()Returns a value indicating whether this reader can parse and resolve entities.
virtual int32_t get_Depth()When overridden in a derived class, gets the depth of the current node in the XML document.
virtual bool get_EOF()When overridden in a derived class, gets 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.
virtual bool get_HasValue()When overridden in a derived class, gets a value indicating whether the current node can have a XmlReader::get_Value value.
virtual bool get_IsDefault()When overridden in a derived class, gets a value indicating whether the current node is an attribute that was generated from the default value defined in the DTD or schema.
virtual bool get_IsEmptyElement()When overridden in a derived class, gets a value indicating whether the current node is an empty element (for example, ).
virtual String get_LocalName()When overridden in a derived class, gets the local name of the current node.
virtual String get_Name()When overridden in a derived class, gets the qualified name of the current node.
virtual String get_NamespaceURI()When overridden in a derived class, gets the namespace URI (as defined in the W3C Namespace specification) of the node on which the reader is positioned.
virtual SharedPtr<XmlNameTable> get_NameTable()When overridden in a derived class, gets the XmlNameTable associated with this implementation.
virtual XmlNodeType get_NodeType()When overridden in a derived class, gets the type of the current node.
virtual String get_Prefix()When overridden in a derived class, gets the namespace prefix associated with the current node.
virtual char16_t get_QuoteChar()When overridden in a derived class, gets the quotation mark character used to enclose the value of an attribute node.
virtual System::Xml::ReadState get_ReadState()When overridden in a derived class, gets 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.
virtual String get_Value()When overridden in a derived class, gets the text value of the current node.
virtual TypeInfo get_ValueType()Returns The type for the current node.
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 the current xml:space scope.
virtual String GetAttribute(String)When overridden in a derived class, gets the value of the attribute with the specified XmlReader::get_Name value.
virtual String GetAttribute(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 String GetAttribute(int32_t)When overridden in a derived class, gets 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.
virtual const TypeInfo& GetType() constGets actual type of object. Analog of C# System.Object.GetType() call.
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.
virtual String LookupNamespace(const String&)When overridden in a derived class, resolves a namespace prefix in the current element’s scope.
virtual ptr MemberwiseClone() constAnalog of C# Object.MemberwiseClone() method. Enables cloning custom types.
virtual bool MoveToAttribute(String)When overridden in a derived class, moves to the attribute with the specified XmlReader::get_Name value.
virtual bool MoveToAttribute(String, String)When overridden in a derived class, moves to the attribute with the specified XmlReader::get_LocalName and XmlReader::get_NamespaceURI values.
virtual void MoveToAttribute(int32_t)When overridden in a derived class, moves 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.
virtual bool MoveToElement()When overridden in a derived class, moves to the element that contains the current attribute node.
virtual bool MoveToFirstAttribute()When overridden in a derived class, moves to the first attribute.
virtual bool MoveToNextAttribute()When overridden in a derived class, moves 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.
virtual bool Read()When overridden in a derived class, reads the next node from the stream.
virtual bool ReadAttributeValue()When overridden in a derived class, parses the attribute value into one or more Text, EntityReference, or EndEntity nodes.
virtual SharedPtr<Object> ReadContentAs(const TypeInfo&, SharedPtr<IXmlNamespaceResolver>)Reads the content as an object of the type specified.
virtual int32_t ReadContentAsBase64(ArrayPtr<uint8_t>, int32_t, int32_t)Reads the content and returns the Base64 decoded binary bytes.
virtual int32_t ReadContentAsBinHex(ArrayPtr<uint8_t>, int32_t, int32_t)Reads 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.
virtual int32_t ReadElementContentAsBase64(ArrayPtr<uint8_t>, int32_t, int32_t)Reads the element and decodes the Base64 content.
virtual int32_t ReadElementContentAsBinHex(ArrayPtr<uint8_t>, int32_t, int32_t)Reads 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.
virtual String ReadString()When overridden in a derived class, reads the contents of an element or text node as a string. However, it is recommended to use the XmlReader::ReadElementContentAsString method instead, because it provides a more straightforward way to handle this operation.
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.
virtual void ResolveEntity()When overridden in a derived class, resolves the entity reference for EntityReference nodes.
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 void Skip()Skips 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.
virtual ~Object()Destroys object. Frees all internal data structures.

Typedefs

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

See Also