Microsoft Information Protection (MIP) SDK for C++: Reference 1.15
Doxygen-generated documentation for MIP SDK written in C++
Loading...
Searching...
No Matches
xml_parser_exception.h
Go to the documentation of this file.
1#ifndef API_MIP_DELEGATE_ERRORS_XML_PARSER_EXCEPTION_H_
2#define API_MIP_DELEGATE_ERRORS_XML_PARSER_EXCEPTION_H_
3
4#include <exception>
5#include <stdexcept>
6#include <string>
7
8#include "mip/mip_namespace.h"
9#include "mip/xml_reader.h"
10
11using std::string;
12
13MIP_NAMESPACE_BEGIN
14
15namespace xml {
16
17// XmlParserException is used by both the XML delegate and a parser within UPE.
18// Because of this, the XmlParserException must remain an inline class so that
19// the code can be included in both places without being included within the 'lite'
20// version of mip_core.
21class XmlParserException : public std::exception {
22public:
23 XmlParserException(const std::string& message, const XmlReader& reader){
24 string name;
25 string value;
26 mMessage = message +
27 ", NodeType: " + std::to_string(static_cast<int>(reader.GetNodeType())) +
28 ", Name: " + (reader.GetName(name) ? ("'" + name + "'") : "NONE" ) +
29 ", Value: " + (reader.GetValue(value) ? ("'" + value + "'") : "NONE") +
30 ", Ancestors: " + reader.GetAncestors();
31 }
32 virtual char const* what() const noexcept override { return mMessage.c_str(); }
33
34private:
35 std::string mMessage;
36};
37
38} // xml
39
40MIP_NAMESPACE_END
41
42#endif // API_MIP_DELEGATE_ERRORS_XML_PARSER_EXCEPTION_H_
XmlParserException(const std::string &message, const XmlReader &reader)
virtual char const * what() const noexcept override
XmlReader abstraction class.
Definition xml_reader.h:48
virtual std::string GetAncestors() const =0
Returns current node ancestors (for debug text), in the following purpose <node grand parent attribut...
virtual bool GetValue(std::string &value) const =0
Returns if value was found.
virtual XmlNodeType GetNodeType() const =0
Get current node type.
virtual std::string GetName() const =0
Returns the name if found, exception otherwise.
MIP namespace macros.
A file containing the XmlReader interface.