[#BloombergLP-balxml-MiniReader-open-02f]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balxml.adoc[balxml]::xref:BloombergLP/balxml/MiniReader.adoc[MiniReader]::open
:relfileprefix: ../../../
:mrdocs:

Set up the reader for parsing the XML data in the specified `stream`&period;

== Synopsis

Declared in `&lt;balxml&lowbar;minireader&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
virtual
int
open(
    std::streambuf* stream,
    char const* url = 0,
    char const* encoding = 0) override;
----

== Description

Set the base URL to the optionally specified `url` and set the encoding value to the optionally specified `encoding` (&quot;ASCII&quot;, &quot;UTF&hyphen;8&quot;, etc)&period; Return 0 on success and non&hyphen;zero otherwise&period; If `url` is null or a blank string is passed, then base URL will be empty&period; The encoding passed to `Reader&colon;&colon;open` will take effect only when there is no encoding information in the original document, i&period;e&period;, the encoding information obtained from the (XML) `stream` trumps all&period; If there is no encoding provided within the document and `encoding` is null or a blank string is passed, then set the encoding to the default &quot;UTF&hyphen;8&quot;&period; It is an error to `open` a reader that is already open&period; Note that the reader will not be on a valid node until `advanceToNextNode` is called&period;

== Return Value

0 on success and non&hyphen;zero otherwise

== Parameters

[cols="1,4"]
|===
| Name| Description
| *stream*
| stream buffer containing the XML document
| *url*
| optional base URL for the document
| *encoding*
| optional document encoding override
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
