25 #ifndef QUEUE_XML_CALLBACKS20091211H 26 #define QUEUE_XML_CALLBACKS20091211H 33 #include <boost/algorithm/string.hpp> 35 #include <xercesc/sax2/Attributes.hpp> 36 #include <xercesc/sax2/DefaultHandler.hpp> 38 #include "goby/common/exception.h" 39 #include "goby/moos/protobuf/transitional.pb.h" 40 #include "goby/moos/transitional/xml/tags.h" 41 #include "goby/util/as.h" 45 namespace transitional
54 xml::initialize_tags(tags_map_);
57 void startElement(
const XMLCh*
const uri,
58 const XMLCh*
const localname,
59 const XMLCh*
const qname,
60 const xercesc::Attributes& attrs);
62 void endElement(
const XMLCh*
const uri,
63 const XMLCh*
const localname,
64 const XMLCh*
const qname);
66 #if XERCES_VERSION_MAJOR < 3 67 void characters(
const XMLCh*
const chars,
const unsigned int length)
69 current_text.append(toNative(chars), 0, length);
72 void characters(
const XMLCh*
const chars,
const XMLSize_t length)
74 current_text.append(toNative(chars), 0, length);
79 bool in_message_var() {
return xml::in_message_var(parents_); }
80 bool in_header_var() {
return xml::in_header_var(parents_); }
81 bool in_publish() {
return xml::in_publish(parents_); }
84 std::vector<goby::transitional::protobuf::QueueConfig>& q_;
85 std::string current_text;
87 std::set<xml::Tag> parents_;
88 std::map<std::string, xml::Tag> tags_map_;
95 void warning(
const xercesc::SAXParseException& e)
97 std::cout <<
"warning:" << toNative(e.getMessage());
99 void error(
const xercesc::SAXParseException& e)
101 XMLSSize_t line = e.getLineNumber();
102 std::stringstream ss;
103 ss <<
"xml parsing error on line " << line <<
": " << std::endl << toNative(e.getMessage());
106 void fatalError(
const xercesc::SAXParseException& e) { error(e); }
The global namespace for the Goby project.
simple exception class for goby applications