11 #include <xercesc/util/PlatformUtils.hpp>
12 #include <xercesc/sax2/SAX2XMLReader.hpp>
13 #include <xercesc/sax2/Attributes.hpp>
15 #include "IsisXMLHelper.h"
16 #include "IsisXMLChTrans.h"
22 namespace XERCES = XERCES_CPP_NAMESPACE;
25 IsisXMLHelper::IsisXMLHelper(
char *PencodingName,
26 bool &PexpandNamespaces,
27 XERCES::SAX2XMLReader* &Pparser,
30 encodingName = PencodingName;
31 expandNamespaces = PexpandNamespaces;
35 prevDocHandler = parser->getContentHandler();
36 prevErrorHandler = parser->getErrorHandler();
38 parser->setContentHandler(
this);
39 parser->setErrorHandler(
this);
42 generalHandler = NULL;
45 IsisXMLHelper::~IsisXMLHelper() {
46 if(ignoreHandler != NULL)
delete ignoreHandler;
47 if(generalHandler != NULL)
delete generalHandler;
52 void IsisXMLHelper::characters(
const XMLCh *
const chars,
53 const XMLSize_t length) {
57 void IsisXMLHelper::endElement(
const XMLCh *
const uri,
58 const XMLCh *
const localname,
59 const XMLCh *
const qname) {
60 parser->setContentHandler(prevDocHandler);
61 parser->setErrorHandler(prevErrorHandler);
64 void IsisXMLHelper::startElement(
const XMLCh *
const uri,
65 const XMLCh *
const localname,
66 const XMLCh *
const qname,
67 const XERCES::Attributes &attributes) {
69 if((
string)XERCES::XMLString::transcode(localname) == (
string)
"brief") {
70 if(generalHandler != NULL) {
71 delete generalHandler;
72 generalHandler = NULL;
74 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces,
75 parser, &helper->brief);
77 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"description") {
78 if(generalHandler != NULL) {
79 delete generalHandler;
80 generalHandler = NULL;
82 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces,
83 parser, &helper->description);
85 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"function") {
86 if(generalHandler != NULL) {
87 delete generalHandler;
88 generalHandler = NULL;
90 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces,
91 parser, &helper->function);
93 else if((
string)XERCES::XMLString::transcode(localname) == (
string)
"icon") {
94 if(generalHandler != NULL) {
95 delete generalHandler;
96 generalHandler = NULL;
98 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces,
99 parser, &helper->icon);
102 if(ignoreHandler != NULL) {
103 delete ignoreHandler;
104 ignoreHandler = NULL;
106 ignoreHandler =
new IsisXMLIgnore(encodingName, expandNamespaces, parser,
107 (
string)XERCES::XMLString::transcode(localname));