summaryrefslogtreecommitdiff
path: root/SDL_Core/tools/intergen/third_party/pugixml/docs/samples/xpath_error.cpp
diff options
context:
space:
mode:
authorJustin Dickow <jjdickow@gmail.com>2014-03-18 13:46:46 -0400
committerJustin Dickow <jjdickow@gmail.com>2014-03-18 13:46:46 -0400
commitba492fb83c258bc60ca68120ce964a95b41133b5 (patch)
treeaf99c087941d65a19831397c1ec5eb34850cfc7f /SDL_Core/tools/intergen/third_party/pugixml/docs/samples/xpath_error.cpp
parent8504605b01177da2e55bee6abe4c3f20c82da379 (diff)
downloadsmartdevicelink-ba492fb83c258bc60ca68120ce964a95b41133b5.tar.gz
initial commit for API 3.0 (replaced all)
Diffstat (limited to 'SDL_Core/tools/intergen/third_party/pugixml/docs/samples/xpath_error.cpp')
-rw-r--r--SDL_Core/tools/intergen/third_party/pugixml/docs/samples/xpath_error.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/SDL_Core/tools/intergen/third_party/pugixml/docs/samples/xpath_error.cpp b/SDL_Core/tools/intergen/third_party/pugixml/docs/samples/xpath_error.cpp
new file mode 100644
index 000000000..6cb6f4fe1
--- /dev/null
+++ b/SDL_Core/tools/intergen/third_party/pugixml/docs/samples/xpath_error.cpp
@@ -0,0 +1,43 @@
+#include "pugixml.hpp"
+
+#include <iostream>
+
+int main()
+{
+ pugi::xml_document doc;
+ if (!doc.load_file("xgconsole.xml")) return -1;
+
+//[code_xpath_error
+ // Exception is thrown for incorrect query syntax
+ try
+ {
+ doc.select_nodes("//nodes[#true()]");
+ }
+ catch (const pugi::xpath_exception& e)
+ {
+ std::cout << "Select failed: " << e.what() << std::endl;
+ }
+
+ // Exception is thrown for incorrect query semantics
+ try
+ {
+ doc.select_nodes("(123)/next");
+ }
+ catch (const pugi::xpath_exception& e)
+ {
+ std::cout << "Select failed: " << e.what() << std::endl;
+ }
+
+ // Exception is thrown for query with incorrect return type
+ try
+ {
+ doc.select_nodes("123");
+ }
+ catch (const pugi::xpath_exception& e)
+ {
+ std::cout << "Select failed: " << e.what() << std::endl;
+ }
+//]
+}
+
+// vim:et