9 #include <xercesc/util/PlatformUtils.hpp>
10 #include <xercesc/sax2/SAX2XMLReader.hpp>
12 #include "IsisXMLMultipleValues.h"
13 #include "IsisXMLChTrans.h"
19 IsisXMLMultipleValues::IsisXMLMultipleValues(
char *PencodingName,
20 bool &PexpandNamespaces,
21 XERCES::SAX2XMLReader* &Pparser,
22 std::vector<QString> *PmultipleValues) {
24 encodingName = PencodingName;
25 expandNamespaces = PexpandNamespaces;
27 multipleValues = PmultipleValues;
29 prevDocHandler = parser->getContentHandler();
30 prevErrorHandler = parser->getErrorHandler();
32 parser->setContentHandler(
this);
33 parser->setErrorHandler(
this);
35 generalHandler = NULL;
39 IsisXMLMultipleValues::~IsisXMLMultipleValues() {
40 if(generalHandler != NULL)
delete generalHandler;
41 if(ignoreHandler != NULL)
delete ignoreHandler;
46 void IsisXMLMultipleValues::characters(
const XMLCh *
const chars,
47 const XMLSize_t length) {}
50 void IsisXMLMultipleValues::endElement(
const XMLCh *
const uri,
51 const XMLCh *
const localname,
52 const XMLCh *
const qname) {
53 parser->setContentHandler(prevDocHandler);
54 parser->setErrorHandler(prevErrorHandler);
58 void IsisXMLMultipleValues::startElement(
const XMLCh *
const uri,
59 const XMLCh *
const localname,
60 const XMLCh *
const qname,
61 const XERCES::Attributes &attributes) {
63 if((
string)XERCES::XMLString::transcode(localname) == (
string)
"item") {
64 if(generalHandler != NULL) {
65 delete generalHandler;
66 generalHandler = NULL;
68 unsigned int index = multipleValues->size();
69 multipleValues->resize(index + 1);
70 generalHandler =
new IsisXMLHandler(encodingName, expandNamespaces,
71 parser, &(*multipleValues)[index]);
74 if(ignoreHandler != NULL) {
78 ignoreHandler =
new IsisXMLIgnore(encodingName, expandNamespaces, parser,
79 (
string)XERCES::XMLString::transcode(localname));