9 #include <xercesc/util/PlatformUtils.hpp>
10 #include <xercesc/sax2/SAX2XMLReader.hpp>
11 #include <xercesc/sax2/Attributes.hpp>
13 #include "IsisXMLHelpers.h"
14 #include "IsisXMLChTrans.h"
18 namespace XERCES = XERCES_CPP_NAMESPACE;
23 IsisXMLHelpers::IsisXMLHelpers(
char *PencodingName,
24 bool &PexpandNamespaces,
25 XERCES::SAX2XMLReader* &Pparser,
26 std::vector<IsisHelperData> *Phelpers) {
28 encodingName = PencodingName;
29 expandNamespaces = PexpandNamespaces;
33 prevDocHandler = parser->getContentHandler();
34 prevErrorHandler = parser->getErrorHandler();
36 parser->setContentHandler(
this);
37 parser->setErrorHandler(
this);
43 IsisXMLHelpers::~IsisXMLHelpers() {
44 if(helperHandler != NULL)
delete helperHandler;
45 if(ignoreHandler != NULL)
delete ignoreHandler;
50 void IsisXMLHelpers::characters(
const XMLCh *
const chars,
51 const XMLSize_t length) {}
54 void IsisXMLHelpers::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 IsisXMLHelpers::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)
"helper") {
68 if(helperHandler != NULL) {
72 unsigned int index = helpers->size();
73 helpers->resize(index + 1);
74 (*helpers)[index].name = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0));
75 helperHandler =
new IsisXMLHelper(encodingName, expandNamespaces, parser,
79 if(ignoreHandler != NULL) {
83 ignoreHandler =
new IsisXMLIgnore(encodingName, expandNamespaces, parser,
84 (
string)XERCES::XMLString::transcode(localname));