10#include <xercesc/sax2/SAX2XMLReader.hpp>
11#include <xercesc/util/XMLException.hpp>
15#include "IException.h"
19#include "IsisXMLHandler.h"
20#include "IsisXMLChTrans.h"
24namespace XERCES = XERCES_CPP_NAMESPACE;
29IsisXMLHandler::IsisXMLHandler() {
35IsisXMLHandler::IsisXMLHandler(
char *PencodingName,
36 bool &PexpandNamespaces,
37 XERCES::SAX2XMLReader* &Pparser,
40 encodingName = PencodingName;
41 expandNamespaces = PexpandNamespaces;
47 prevDocHandler = parser->getContentHandler();
48 prevErrorHandler = parser->getErrorHandler();
50 parser->setContentHandler(
this);
51 parser->setErrorHandler(
this);
55IsisXMLHandler::IsisXMLHandler(
char *PencodingName,
56 bool &PexpandNamespaces,
57 XERCES::SAX2XMLReader* &Pparser) {
62 encodingName = PencodingName;
63 expandNamespaces = PexpandNamespaces;
66 prevDocHandler = parser->getContentHandler();
67 prevErrorHandler = parser->getErrorHandler();
69 parser->setContentHandler(
this);
70 parser->setErrorHandler(
this);
74IsisXMLHandler::~IsisXMLHandler() {}
78void IsisXMLHandler::error(
const XERCES::SAXParseException &e) {
80 os <<
"Error in application XML file line: " << e.getLineNumber()
81 <<
" char: " << e.getColumnNumber() <<
". "
82 << XERCES::XMLString::transcode(e.getMessage());
86void IsisXMLHandler::fatalError(
const XERCES::SAXParseException &e) {
88 os <<
"Error in application XML file line: " << e.getLineNumber()
89 <<
" char: " << e.getColumnNumber() <<
". "
90 << XERCES::XMLString::transcode(e.getMessage());
94void IsisXMLHandler::warning(
const XERCES::SAXParseException &e) {
96 os <<
"Error in application XML file line: " << e.getLineNumber()
97 <<
" char: " << e.getColumnNumber() <<
". "
98 << XERCES::XMLString::transcode(e.getMessage());
104void IsisXMLHandler::characters(
const XMLCh *
const chars,
105 const XMLSize_t length) {
109 str = XERCES::XMLString::transcode(chars);
116void IsisXMLHandler::endDocument() {
120void IsisXMLHandler::endElement(
const XMLCh *
const uri,
121 const XMLCh *
const localname,
122 const XMLCh *
const qname) {
124 if(outputEndTag > 0) {
126 str = XERCES::XMLString::transcode(localname);
127 *value +=
"</" + str +
">";
131 parser->setContentHandler(prevDocHandler);
132 parser->setErrorHandler(prevErrorHandler);
137void IsisXMLHandler::ignorableWhitespace(
const XMLCh *
const chars,
138 const unsigned int length) {
142void IsisXMLHandler::processingInstruction(
const XMLCh *
const target,
143 const XMLCh *
const data) {
147void IsisXMLHandler::startDocument() {
151void IsisXMLHandler::startElement(
const XMLCh *
const uri,
152 const XMLCh *
const localname,
153 const XMLCh *
const qname,
154 const XERCES::Attributes &attributes) {
158 str = XERCES::XMLString::transcode(localname);
160 *value +=
"<" + str +
">";
@ Programmer
This error is for when a programmer made an API call that was illegal.
Namespace for the standard library.