Isis 3 Programmer Reference
IsisXMLApplication.cpp
Go to the documentation of this file.
1 
24 #include <string>
25 
26 #include <xercesc/sax2/SAX2XMLReader.hpp>
27 #include <xercesc/sax2/Attributes.hpp>
28 #include <xercesc/util/PlatformUtils.hpp>
29 
30 #include "IsisXMLApplication.h"
31 #include "IsisXMLChTrans.h"
32 
33 #include "IString.h"
34 
35 using namespace std;
36 
37 // Constructors
38 IsisXMLApplication::IsisXMLApplication(char *PencodingName,
39  bool &PexpandNamespaces,
40  XERCES::SAX2XMLReader* &Pparser,
41  IsisAmlData *PappData) {
42 
43  encodingName = PencodingName;
44  expandNamespaces = PexpandNamespaces;
45  parser = Pparser;
46  appData = PappData;
47 
48  parser->setContentHandler(this);
49  parser->setErrorHandler(this);
50 
51  briefHandler = NULL;
52  descriptionHandler = NULL;
53  groupsHandler = NULL;
54  multipleValuesHandler = NULL;
55  ignoreHandler = NULL;
56  historyHandler = NULL;
57 
58 }
59 
60 IsisXMLApplication::~IsisXMLApplication() {
61 
62  if(briefHandler != NULL) delete briefHandler;
63  if(descriptionHandler != NULL) delete descriptionHandler;
64  if(groupsHandler != NULL) delete groupsHandler;
65  if(multipleValuesHandler != NULL) delete multipleValuesHandler;
66  if(ignoreHandler != NULL) delete ignoreHandler;
67  if(historyHandler != NULL) delete historyHandler;
68 }
69 
70 
71 // Callback methodes for handling pieces of the xml file
72 
73 // IsisXMLApplication: Overrides of the SAX DocumentHandler interface
74 void IsisXMLApplication::characters(const XMLCh *const chars,
75  const XMLSize_t length) {}
76 
77 
78 
79 void IsisXMLApplication::endDocument() {}
80 
81 
82 void IsisXMLApplication::endElement(const XMLCh *const uri,
83  const XMLCh *const localname,
84  const XMLCh *const qname) {
85 }
86 
87 
88 void IsisXMLApplication::processingInstruction(const XMLCh *const target,
89  const XMLCh *const data) {}
90 
91 
92 void IsisXMLApplication::startDocument() {}
93 
94 
95 void IsisXMLApplication::startElement(const XMLCh *const uri,
96  const XMLCh *const localname,
97  const XMLCh *const qname,
98  const XERCES::Attributes &attributes) {
99 
100  if((string)XERCES::XMLString::transcode(localname) == (string)"application") {
101  QString name = XERCES::XMLString::transcode(attributes.getValue((XMLSize_t)0));
102  appData->name = name.toLower();
103  }
104  else if((string)XERCES::XMLString::transcode(localname) == (string)"brief") {
105  if(briefHandler != NULL) {
106  delete briefHandler;
107  briefHandler = NULL;
108  }
109  briefHandler = new IsisXMLHandler(encodingName, expandNamespaces,
110  parser, &appData->brief);
111  }
112  else if((string)XERCES::XMLString::transcode(localname) == (string)"description") {
113  if(descriptionHandler != NULL) {
114  delete descriptionHandler;
115  descriptionHandler = NULL;
116  }
117  descriptionHandler = new IsisXMLHandler(encodingName, expandNamespaces,
118  parser, &appData->description);
119  }
120  else if((string)XERCES::XMLString::transcode(localname) == (string)"groups") {
121  if(groupsHandler != NULL) {
122  delete groupsHandler;
123  groupsHandler = NULL;
124  }
125  groupsHandler = new IsisXMLGroups(encodingName, expandNamespaces, parser,
126  &appData->groups);
127  }
128  else if((string)XERCES::XMLString::transcode(localname) == (string)"category") {
129  if(multipleValuesHandler != NULL) {
130  delete multipleValuesHandler;
131  multipleValuesHandler = NULL;
132  }
133  multipleValuesHandler = new IsisXMLMultipleValues(encodingName, expandNamespaces,
134  parser, &appData->categorys);
135  }
136  else if((string)XERCES::XMLString::transcode(localname) == (string)"history") {
137  if(historyHandler != NULL) {
138  delete historyHandler;
139  historyHandler = NULL;
140  }
141  historyHandler = new IsisXMLHistory(encodingName, expandNamespaces,
142  parser, &appData->changes);
143  }
144  else {
145  if(ignoreHandler != NULL) {
146  delete ignoreHandler;
147  ignoreHandler = NULL;
148  }
149  ignoreHandler = new IsisXMLIgnore(encodingName, expandNamespaces, parser,
150  (string)XERCES::XMLString::transcode(localname));
151  }
152 }
Namespace for the standard library.