22#include <unordered_map>
29 using Attributes = std::unordered_map<std::string,std::string>;
34 using ErrorType = void(
const std::string,
int,
const std::string &);
46 auto it = attrib.find(key);
97 const char *inputString,
99 std::function<
void()> debugStart,
100 std::function<
void()> debugEnd,
101 std::function<Transcode> transcoder =
102 [](std::string&s,
const char *){
return true; }
106 int lineNr()
const override;
107 std::string
fileName()
const override;
109 std::unique_ptr<Private>
p;
Event handlers that can installed by the client and called while parsing a XML document.
std::unordered_map< std::string, std::string > Attributes
void(const std::string &) CharsType
std::function< EndElementType > endElement
handler invoked when a closing tag has been found
void(const std::string &, const Attributes &) StartElementType
std::function< StartElementType > startElement
handler invoked when an opening tag has been found
std::function< EndDocType > endDocument
handler invoked at the end of the document
void(const std::string, int, const std::string &) ErrorType
std::function< CharsType > characters
handler invoked when content between tags has been found
void(const std::string &) EndElementType
static std::string value(const Attributes &attrib, const std::string &key)
std::function< ErrorType > error
handler invoked when the parser encounters an error
std::function< StartDocType > startDocument
handler invoked at the start of the document
virtual ~XMLLocator()=default
XMLLocator & operator=(XMLLocator &&)=delete
virtual int lineNr() const =0
XMLLocator & operator=(const XMLLocator &)=delete
XMLLocator(XMLLocator &&)=delete
XMLLocator(const XMLLocator &)=delete
virtual std::string fileName() const =0
XMLParser & operator=(XMLParser &&)=delete
int lineNr() const override
bool(std::string &, const char *) Transcode
std::unique_ptr< Private > p
XMLParser & operator=(const XMLParser &)=delete
std::string fileName() const override
XMLParser(XMLParser &&)=delete
XMLParser(const XMLHandlers &handlers)
XMLParser(const XMLParser &)=delete
void parse(const char *fileName, const char *inputString, bool debugEnabled, std::function< void()> debugStart, std::function< void()> debugEnd, std::function< Transcode > transcoder=[](std::string &s, const char *){ return true;})