10 #include <xercesc/util/PlatformUtils.hpp>
11 #include <xercesc/sax2/SAX2XMLReader.hpp>
12 #include <xercesc/sax2/Attributes.hpp>
14 #include "IsisXMLGroup.h"
15 #include "IsisXMLChTrans.h"
21 namespace XERCES = XERCES_CPP_NAMESPACE;
24 IsisXMLGroup::IsisXMLGroup(
char *PencodingName,
25 bool &PexpandNamespaces,
26 XERCES::SAX2XMLReader* &Pparser,
29 encodingName = PencodingName;
30 expandNamespaces = PexpandNamespaces;
34 prevDocHandler = parser->getContentHandler();
35 prevErrorHandler = parser->getErrorHandler();
37 parser->setContentHandler(
this);
38 parser->setErrorHandler(
this);
40 parameterHandler = NULL;
45 IsisXMLGroup::~IsisXMLGroup() {
47 if(parameterHandler != NULL)
delete parameterHandler;
48 if(ignoreHandler != NULL)
delete ignoreHandler;
53 void IsisXMLGroup::characters(
const XMLCh *
const chars,
54 const XMLSize_t length) {
58 void IsisXMLGroup::endElement(
const XMLCh *
const uri,
59 const XMLCh *
const localname,
60 const XMLCh *
const qname) {
61 parser->setContentHandler(prevDocHandler);
62 parser->setErrorHandler(prevErrorHandler);
65 void IsisXMLGroup::startElement(
const XMLCh *
const uri,
66 const XMLCh *
const localname,
67 const XMLCh *
const qname,
68 const XERCES::Attributes &attributes) {
70 if((
string)XERCES::XMLString::transcode(localname) == (
string)
"parameter") {
71 if(parameterHandler != NULL) {
72 delete parameterHandler;
73 parameterHandler = NULL;
75 unsigned int index = group->parameters.size();
76 group->parameters.resize(index + 1);
77 QString name = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0));
79 group->parameters[index].name = name;
81 parser, &group->parameters[index]);
84 if(ignoreHandler != NULL) {
88 ignoreHandler =
new IsisXMLIgnore(encodingName, expandNamespaces, parser,
89 (
string)XERCES::XMLString::transcode(localname));