mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-17 18:12:04 +01:00
beefed up error reporting a bit
This commit is contained in:
parent
ad69b4658e
commit
3110715864
1 changed files with 20 additions and 11 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue