9 #include <xercesc/util/PlatformUtils.hpp>
10 #include <xercesc/sax2/SAX2XMLReader.hpp>
11 #include <xercesc/sax2/Attributes.hpp>
13 #include "IsisXMLHistory.h"
14 #include "IsisXMLChTrans.h"
18 namespace XERCES = XERCES_CPP_NAMESPACE;
23 IsisXMLHistory::IsisXMLHistory(
char *PencodingName,
24 bool &PexpandNamespaces,
25 XERCES::SAX2XMLReader* &Pparser,
26 std::vector<IsisChangeData> *Pchanges) {
28 encodingName = PencodingName;
29 expandNamespaces = PexpandNamespaces;
33 prevDocHandler = parser->getContentHandler();
34 prevErrorHandler = parser->getErrorHandler();
36 parser->setContentHandler(
this);
37 parser->setErrorHandler(
this);
39 generalHandler = NULL;
43 IsisXMLHistory::~IsisXMLHistory() {
44 if(generalHandler != NULL)
delete generalHandler;
45 if(ignoreHandler != NULL)
delete ignoreHandler;
50 void IsisXMLHistory::characters(
const XMLCh *
const chars,
51 const XMLSize_t length) {}
54 void IsisXMLHistory::endElement(
const XMLCh *
const uri,
55 const XMLCh *
const localname,
56 const XMLCh *
const qname) {
57 parser->setContentHandler(prevDocHandler);
58 parser->setErrorHandler(prevErrorHandler);
62 void IsisXMLHistory::startElement(
const XMLCh *
const uri,
63 const XMLCh *
const localname,
64 const XMLCh *
const qname,
65 const XERCES::Attributes &attributes) {
67 if((
string)XERCES::XMLString::transcode(localname) == (
string)
"change") {
68 if(generalHandler != NULL) {
69 delete generalHandler;
70 generalHandler = NULL;
74 unsigned int index = changes->size();
75 changes->resize(index + 1);
79 for(
unsigned int i = 0; i < 2; i++) {
80 st = XERCES::XMLString::transcode(attributes.getQName(i));
82 (*changes)[index].name = XERCES::XMLString::transcode(attributes.getValue(i));
84 else if(st ==
"date") {
85 (*changes)[index].date = XERCES::XMLString::transcode(attributes.getValue(i));
89 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces,
90 parser, &(*changes)[index].description);
93 if(ignoreHandler != NULL) {
97 ignoreHandler =
new IsisXMLIgnore(encodingName, expandNamespaces, parser,
98 (
string)XERCES::XMLString::transcode(localname));