Create()

XmlReader::Create(const String&) method

Creates a new XmlReader instance with specified URI.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const String &inputUri)

Arguments

ParameterTypeDescription
inputUriconst String&The URI for the file that contains the XML data. The XmlUrlResolver class is used to convert the path to a canonical data representation.

Return Value

An object that is used to read the XML data in the stream.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe inputUri value is nullptr.
SecurityExceptionThe XmlReader does not have sufficient permissions to access the location of the XML data.
FileNotFoundExceptionThe file identified by the URI does not exist.
UriFormatExceptionThe URI format is not correct.

XmlReader::Create(const String&, const SharedPtr<XmlReaderSettings>&) method

Creates a new XmlReader instance by using the specified URI and settings.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const String &inputUri, const SharedPtr<XmlReaderSettings> &settings)

Arguments

ParameterTypeDescription
inputUriconst String&The URI for the file containing the XML data. The XmlResolver object on the XmlReaderSettings object is used to convert the path to a canonical data representation. If XmlReaderSettings::get_XmlResolver value is nullptr, a new XmlUrlResolver object is used.
settingsconst SharedPtr<XmlReaderSettings>&The settings for the new XmlReader instance. This value can be nullptr.

Return Value

An object that is used to read the XML data in the stream.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe inputUri value is nullptr.
FileNotFoundExceptionThe file specified by the URI cannot be found.
UriFormatExceptionThe URI format is not correct.

XmlReader::Create(const String&, SharedPtr<XmlReaderSettings>, const SharedPtr<XmlParserContext>&) method

Creates a new XmlReader instance by using the specified URI, settings, and context information for parsing.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const String &inputUri, SharedPtr<XmlReaderSettings> settings, const SharedPtr<XmlParserContext> &inputContext)

Arguments

ParameterTypeDescription
inputUriconst String&The URI for the file containing the XML data. The XmlResolver object on the XmlReaderSettings object is used to convert the path to a canonical data representation. If XmlReaderSettings::get_XmlResolver value is nullptr, a new XmlUrlResolver object is used.
settingsSharedPtr<XmlReaderSettings>The settings for the new XmlReader instance. This value can be nullptr.
inputContextconst SharedPtr<XmlParserContext>&The context information required to parse the XML fragment. The context information can include the XmlNameTable to use, encoding, namespace scope, the current xml:lang and xml:space scope, base URI, and document type definition. This value can be nullptr.

Return Value

An object that is used to read the XML data in the stream.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe inputUri value is nullptr.
SecurityExceptionThe XmlReader does not have sufficient permissions to access the location of the XML data.
ArgumentExceptionThe XmlReaderSettings::get_NameTable and XmlParserContext::get_NameTable both are non-nullptr values. (Only one of these NameTable values can be set and used).
FileNotFoundExceptionThe file specified by the URI cannot be found.
UriFormatExceptionThe URI format is not correct.

XmlReader::Create(const SharedPtr<IO::Stream>&) method

Creates a new XmlReader instance using the specified stream with default settings.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const SharedPtr<IO::Stream> &input)

Arguments

ParameterTypeDescription
inputconst SharedPtr<IO::Stream>&The stream that contains the XML data. The XmlReader scans the first bytes of the stream looking for a byte order mark or other sign of encoding. When encoding is determined, the encoding is used to continue reading the stream, and processing continues parsing the input as a stream of (Unicode) characters.

Return Value

An object that is used to read the XML data in the stream.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe input value is nullptr.
SecurityExceptionThe XmlReader does not have sufficient permissions to access the location of the XML data.

XmlReader::Create(const SharedPtr<IO::Stream>&, const SharedPtr<XmlReaderSettings>&) method

Creates a new XmlReader instance with the specified stream and settings.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const SharedPtr<IO::Stream> &input, const SharedPtr<XmlReaderSettings> &settings)

Arguments

ParameterTypeDescription
inputconst SharedPtr<IO::Stream>&The stream that contains the XML data. The XmlReader scans the first bytes of the stream looking for a byte order mark or other sign of encoding. When encoding is determined, the encoding is used to continue reading the stream, and processing continues parsing the input as a stream of (Unicode) characters.
settingsconst SharedPtr<XmlReaderSettings>&The settings for the new XmlReader instance. This value can be nullptr.

Return Value

An object that is used to read the XML data in the stream.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe input value is nullptr.

XmlReader::Create(const SharedPtr<IO::Stream>&, SharedPtr<XmlReaderSettings>, const String&) method

Creates a new XmlReader instance using the specified stream, base URI, and settings.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const SharedPtr<IO::Stream> &input, SharedPtr<XmlReaderSettings> settings, const String &baseUri)

Arguments

ParameterTypeDescription
inputconst SharedPtr<IO::Stream>&The stream that contains the XML data. The XmlReader scans the first bytes of the stream looking for a byte order mark or other sign of encoding. When encoding is determined, the encoding is used to continue reading the stream, and processing continues parsing the input as a stream of (Unicode) characters.
settingsSharedPtr<XmlReaderSettings>The settings for the new XmlReader instance. This value can be nullptr.
baseUriconst String&The base URI for the entity or document being read. This value can be nullptr. Security Note The base URI is used to resolve the relative URI of the XML document. Do not use a base URI from an untrusted source.

Return Value

An object that is used to read the XML data in the stream.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe input value is nullptr.

XmlReader::Create(const SharedPtr<IO::Stream>&, SharedPtr<XmlReaderSettings>, const SharedPtr<XmlParserContext>&) method

Creates a new XmlReader instance using the specified stream, settings, and context information for parsing.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const SharedPtr<IO::Stream> &input, SharedPtr<XmlReaderSettings> settings, const SharedPtr<XmlParserContext> &inputContext)

Arguments

ParameterTypeDescription
inputconst SharedPtr<IO::Stream>&The stream that contains the XML data. The XmlReader scans the first bytes of the stream looking for a byte order mark or other sign of encoding. When encoding is determined, the encoding is used to continue reading the stream, and processing continues parsing the input as a stream of (Unicode) characters.
settingsSharedPtr<XmlReaderSettings>The settings for the new XmlReader instance. This value can be nullptr.
inputContextconst SharedPtr<XmlParserContext>&The context information required to parse the XML fragment. The context information can include the XmlNameTable to use, encoding, namespace scope, the current xml:lang and xml:space scope, base URI, and document type definition. This value can be nullptr.

Return Value

An object that is used to read the XML data in the stream.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe input value is nullptr.

XmlReader::Create(const SharedPtr<IO::TextReader>&) method

Creates a new XmlReader instance by using the specified text reader.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const SharedPtr<IO::TextReader> &input)

Arguments

ParameterTypeDescription
inputconst SharedPtr<IO::TextReader>&The text reader from which to read the XML data. A text reader returns a stream of Unicode characters, so the encoding specified in the XML declaration is not used by the XML reader to decode the data stream.

Return Value

An object that is used to read the XML data in the stream.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe input value is nullptr.

XmlReader::Create(const SharedPtr<IO::TextReader>&, const SharedPtr<XmlReaderSettings>&) method

Creates a new XmlReader instance by using the specified text reader and settings.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const SharedPtr<IO::TextReader> &input, const SharedPtr<XmlReaderSettings> &settings)

Arguments

ParameterTypeDescription
inputconst SharedPtr<IO::TextReader>&The text reader from which to read the XML data. A text reader returns a stream of Unicode characters, so the encoding specified in the XML declaration isn’t used by the XML reader to decode the data stream.
settingsconst SharedPtr<XmlReaderSettings>&The settings for the new XmlReader. This value can be nullptr.

Return Value

An object that is used to read the XML data in the stream.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe input value is nullptr.

XmlReader::Create(const SharedPtr<IO::TextReader>&, SharedPtr<XmlReaderSettings>, const String&) method

Creates a new XmlReader instance by using the specified text reader, settings, and base URI.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const SharedPtr<IO::TextReader> &input, SharedPtr<XmlReaderSettings> settings, const String &baseUri)

Arguments

ParameterTypeDescription
inputconst SharedPtr<IO::TextReader>&The text reader from which to read the XML data. A text reader returns a stream of Unicode characters, so the encoding specified in the XML declaration isn’t used by the XmlReader to decode the data stream.
settingsSharedPtr<XmlReaderSettings>The settings for the new XmlReader instance. This value can be nullptr.
baseUriconst String&The base URI for the entity or document being read. This value can be nullptr. Security Note The base URI is used to resolve the relative URI of the XML document. Do not use a base URI from an untrusted source.

Return Value

An object that is used to read the XML data in the stream.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe input value is nullptr.

XmlReader::Create(const SharedPtr<IO::TextReader>&, SharedPtr<XmlReaderSettings>, const SharedPtr<XmlParserContext>&) method

Creates a new XmlReader instance by using the specified text reader, settings, and context information for parsing.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const SharedPtr<IO::TextReader> &input, SharedPtr<XmlReaderSettings> settings, const SharedPtr<XmlParserContext> &inputContext)

Arguments

ParameterTypeDescription
inputconst SharedPtr<IO::TextReader>&The text reader from which to read the XML data. A text reader returns a stream of Unicode characters, so the encoding specified in the XML declaration isn’t used by the XML reader to decode the data stream.
settingsSharedPtr<XmlReaderSettings>The settings for the new XmlReader instance. This value can be nullptr.
inputContextconst SharedPtr<XmlParserContext>&The context information required to parse the XML fragment. The context information can include the XmlNameTable to use, encoding, namespace scope, the current xml:lang and xml:space scope, base URI, and document type definition. This value can be nullptr.

Return Value

An object that is used to read the XML data in the stream.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe input value is nullptr.
ArgumentExceptionThe XmlReaderSettings::get_NameTable and XmlParserContext::get_NameTable both are non-nullptr values. (Only one of these NameTable values can be set and used).

XmlReader::Create(const SharedPtr<XmlReader>&, SharedPtr<XmlReaderSettings>) method

Creates a new XmlReader instance by using the specified XML reader and settings.

static SharedPtr<XmlReader> System::Xml::XmlReader::Create(const SharedPtr<XmlReader> &reader, SharedPtr<XmlReaderSettings> settings)

Arguments

ParameterTypeDescription
readerconst SharedPtr<XmlReader>&The object that you want to use as the underlying XML reader.
settingsSharedPtr<XmlReaderSettings>The settings for the new XmlReader instance. The conformance level of the XmlReaderSettings object must either match the conformance level of the underlying reader, or it must be set to ConformanceLevel::Auto.

Return Value

An object that is wrapped around the specified XmlReader object.

Exceptions

ExceptionDescription
ArgumentNullExceptionThe reader value is nullptr.
InvalidOperationExceptionIf the XmlReaderSettings object specifies a conformance level that is not consistent with conformance level of the underlying reader. The underlying XmlReader is in an ReadState::Error or ReadState::Closed state.

See Also