27 #include <xercesc/util/PlatformUtils.hpp> 28 #include <xercesc/sax2/SAX2XMLReader.hpp> 29 #include <xercesc/sax2/Attributes.hpp> 36 namespace XERCES = XERCES_CPP_NAMESPACE;
41 IsisXMLHistory::IsisXMLHistory(
char *PencodingName,
42 bool &PexpandNamespaces,
43 XERCES::SAX2XMLReader* &Pparser,
44 std::vector<IsisChangeData> *Pchanges) {
46 encodingName = PencodingName;
47 expandNamespaces = PexpandNamespaces;
51 prevDocHandler = parser->getContentHandler();
52 prevErrorHandler = parser->getErrorHandler();
54 parser->setContentHandler(
this);
55 parser->setErrorHandler(
this);
57 generalHandler = NULL;
61 IsisXMLHistory::~IsisXMLHistory() {
62 if(generalHandler != NULL)
delete generalHandler;
63 if(ignoreHandler != NULL)
delete ignoreHandler;
68 void IsisXMLHistory::characters(
const XMLCh *
const chars,
69 const XMLSize_t length) {}
72 void IsisXMLHistory::endElement(
const XMLCh *
const uri,
73 const XMLCh *
const localname,
74 const XMLCh *
const qname) {
75 parser->setContentHandler(prevDocHandler);
76 parser->setErrorHandler(prevErrorHandler);
80 void IsisXMLHistory::startElement(
const XMLCh *
const uri,
81 const XMLCh *
const localname,
82 const XMLCh *
const qname,
83 const XERCES::Attributes &attributes) {
85 if((
string)XERCES::XMLString::transcode(localname) == (
string)
"change") {
86 if(generalHandler != NULL) {
87 delete generalHandler;
88 generalHandler = NULL;
92 unsigned int index = changes->size();
93 changes->resize(index + 1);
97 for(
unsigned int i = 0; i < 2; i++) {
98 st = XERCES::XMLString::transcode(attributes.getQName(i));
100 (*changes)[index].name = XERCES::XMLString::transcode(attributes.getValue(i));
102 else if(st ==
"date") {
103 (*changes)[index].date = XERCES::XMLString::transcode(attributes.getValue(i));
107 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces,
108 parser, &(*changes)[index].description);
111 if(ignoreHandler != NULL) {
112 delete ignoreHandler;
113 ignoreHandler = NULL;
115 ignoreHandler =
new IsisXMLIgnore(encodingName, expandNamespaces, parser,
116 (
string)XERCES::XMLString::transcode(localname));
Namespace for the standard library.