beefed up error reporting a bit

This commit is contained in:
jez_higgins 2004-05-12 19:38:54 +00:00
parent ad69b4658e
commit 3110715864

View file

@ -32,8 +32,11 @@ class SAX2PYX : public SAX::DefaultHandler
virtual void warning(const SAX::SAXParseException& e) { fatalError(e); }
virtual void error(const SAX::SAXParseException& e) { fatalError(e); }
void setParser(SAX::XMLReader<std::string>& parser) { parser_ = &parser; }
private:
std::string escape(const std::string& str) const;
SAX::XMLReader<std::string>* parser_;
}; // class SimpleHandler
int main(int argc, char* argv[])
@ -53,6 +56,7 @@ int main(int argc, char* argv[])
SAX::XMLReader<std::string> myParser;
myParser.setContentHandler(handler);
myParser.setErrorHandler(handler);
handler.setParser(myParser);
SAX::InputSource is(argv[i]);
myParser.parse(is);
@ -79,6 +83,11 @@ void SAX2PYX::startElement(const std::string&, const std::string& localName,
<< std::endl;
} // for ...
std::cerr << " "
<< parser_->getLineNumber()
<< ","
<< parser_->getColumnNumber()
<< std::endl;
} // startElement
void SAX2PYX::endElement(const std::string&, const std::string& localName,