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