10 #include <xercesc/util/PlatformUtils.hpp>
11 #include <xercesc/sax2/SAX2XMLReader.hpp>
12 #include <xercesc/sax2/Attributes.hpp>
14 #include "IsisXMLGroups.h"
15 #include "IsisXMLChTrans.h"
19 namespace XERCES = XERCES_CPP_NAMESPACE;
24 IsisXMLGroups::IsisXMLGroups(
char *PencodingName,
25 bool &PexpandNamespaces,
26 XERCES::SAX2XMLReader* &Pparser,
27 std::vector<IsisGroupData> *Pgroups) {
29 encodingName = PencodingName;
30 expandNamespaces = PexpandNamespaces;
34 prevDocHandler = parser->getContentHandler();
35 prevErrorHandler = parser->getErrorHandler();
37 parser->setContentHandler(
this);
38 parser->setErrorHandler(
this);
44 IsisXMLGroups::~IsisXMLGroups() {
45 if(groupHandler != NULL)
delete groupHandler;
46 if(ignoreHandler != NULL)
delete ignoreHandler;
51 void IsisXMLGroups::characters(
const XMLCh *
const chars,
52 const XMLSize_t length) {}
55 void IsisXMLGroups::endElement(
const XMLCh *
const uri,
56 const XMLCh *
const localname,
57 const XMLCh *
const qname) {
58 parser->setContentHandler(prevDocHandler);
59 parser->setErrorHandler(prevErrorHandler);
63 void IsisXMLGroups::startElement(
const XMLCh *
const uri,
64 const XMLCh *
const localname,
65 const XMLCh *
const qname,
66 const XERCES::Attributes &attributes) {
68 if((
string)XERCES::XMLString::transcode(localname) == (
string)
"group") {
69 if(groupHandler != NULL) {
73 unsigned int index = groups->size();
74 groups->resize(index + 1);
75 (*groups)[index].name = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0));
76 groupHandler =
new IsisXMLGroup(encodingName, expandNamespaces, parser,
80 if(ignoreHandler != NULL) {
84 ignoreHandler =
new IsisXMLIgnore(encodingName, expandNamespaces, parser,
85 (
string)XERCES::XMLString::transcode(localname));