26 #include <xercesc/sax2/SAX2XMLReader.hpp> 27 #include <xercesc/util/XMLException.hpp> 40 namespace XERCES = XERCES_CPP_NAMESPACE;
45 IsisXMLHandler::IsisXMLHandler() {
51 IsisXMLHandler::IsisXMLHandler(
char *PencodingName,
52 bool &PexpandNamespaces,
53 XERCES::SAX2XMLReader* &Pparser,
56 encodingName = PencodingName;
57 expandNamespaces = PexpandNamespaces;
63 prevDocHandler = parser->getContentHandler();
64 prevErrorHandler = parser->getErrorHandler();
66 parser->setContentHandler(
this);
67 parser->setErrorHandler(
this);
71 IsisXMLHandler::IsisXMLHandler(
char *PencodingName,
72 bool &PexpandNamespaces,
73 XERCES::SAX2XMLReader* &Pparser) {
78 encodingName = PencodingName;
79 expandNamespaces = PexpandNamespaces;
82 prevDocHandler = parser->getContentHandler();
83 prevErrorHandler = parser->getErrorHandler();
85 parser->setContentHandler(
this);
86 parser->setErrorHandler(
this);
90 IsisXMLHandler::~IsisXMLHandler() {}
94 void IsisXMLHandler::error(
const XERCES::SAXParseException &e) {
96 os <<
"Error in application XML file line: " << e.getLineNumber()
97 <<
" char: " << e.getColumnNumber() <<
". " 98 << XERCES::XMLString::transcode(e.getMessage());
102 void IsisXMLHandler::fatalError(
const XERCES::SAXParseException &e) {
104 os <<
"Error in application XML file line: " << e.getLineNumber()
105 <<
" char: " << e.getColumnNumber() <<
". " 106 << XERCES::XMLString::transcode(e.getMessage());
110 void IsisXMLHandler::warning(
const XERCES::SAXParseException &e) {
112 os <<
"Error in application XML file line: " << e.getLineNumber()
113 <<
" char: " << e.getColumnNumber() <<
". " 114 << XERCES::XMLString::transcode(e.getMessage());
120 void IsisXMLHandler::characters(
const XMLCh *
const chars,
121 const XMLSize_t length) {
125 str = XERCES::XMLString::transcode(chars);
132 void IsisXMLHandler::endDocument() {
136 void IsisXMLHandler::endElement(
const XMLCh *
const uri,
137 const XMLCh *
const localname,
138 const XMLCh *
const qname) {
140 if(outputEndTag > 0) {
142 str = XERCES::XMLString::transcode(localname);
143 *value +=
"</" + str +
">";
147 parser->setContentHandler(prevDocHandler);
148 parser->setErrorHandler(prevErrorHandler);
153 void IsisXMLHandler::ignorableWhitespace(
const XMLCh *
const chars,
154 const unsigned int length) {
158 void IsisXMLHandler::processingInstruction(
const XMLCh *
const target,
159 const XMLCh *
const data) {
163 void IsisXMLHandler::startDocument() {
167 void IsisXMLHandler::startElement(
const XMLCh *
const uri,
168 const XMLCh *
const localname,
169 const XMLCh *
const qname,
170 const XERCES::Attributes &attributes) {
174 str = XERCES::XMLString::transcode(localname);
176 *value +=
"<" + str +
">";
Namespace for the standard library.
This error is for when a programmer made an API call that was illegal.
#define _FILEINFO_
Macro for the filename and line number.