libfilezilla
|
A streaming XML parser. More...
#include <xml.hpp>
Public Types | |
typedef std::function< bool(callback_event type, std::string_view path, std::string_view name, std::string &&value)> | callback_t |
Public Member Functions | |
parser (callback_t const &cb) | |
parser (callback_t &&cb) | |
void | set_callback (callback_t &&cb) |
void | set_callback (callback_t const &cb) |
bool | parse (std::string_view data) |
Processes the block of data. Can be partial. | |
bool | finalize () |
std::string | get_error () const |
Returns an error description. Empty if parsing was stopped by a callback. | |
void | set_limits (size_t value_size_limit, size_t path_size_limit) |
A streaming XML parser.
Supports input data in UTF-8, UTF-16-BE and UTF-16-LE, detected automatically.
Can parse XML in chunks of any size, including bytewise in all supported character sets.
typedef std::function<bool(callback_event type, std::string_view path, std::string_view name, std::string && value)> callback_t |
Callbacks return whether parsing should continue.
bool finalize | ( | ) |
After parsing all data, finalize the document to check that it is terminated properly.
void set_callback | ( | callback_t && | cb | ) |
The passed callback function will be invoked for each event during the parse. Don't call any parser function from a callback.
void set_limits | ( | size_t | value_size_limit, |
size_t | path_size_limit | ||
) |
These limits are checked after processing a block of input data. They may be temporarily exceeded by the size of the last block of input data.