File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
IsisXMLList.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include <string>
8 
9 #include <xercesc/util/PlatformUtils.hpp>
10 #include <xercesc/sax2/SAX2XMLReader.hpp>
11 #include <xercesc/sax2/Attributes.hpp>
12 
13 #include "IsisXMLList.h"
14 #include "IsisXMLChTrans.h"
15 
16 using namespace std;
17 
18 namespace XERCES = XERCES_CPP_NAMESPACE;
19 
20 // Constructors
21 IsisXMLList::IsisXMLList(char *PencodingName,
22  bool &PexpandNamespaces,
23  XERCES::SAX2XMLReader* &Pparser,
24  IsisListOptionData *Plist) {
25 
26  encodingName = PencodingName;
27  expandNamespaces = PexpandNamespaces;
28  parser = Pparser;
29  list = Plist;
30 
31  prevDocHandler = parser->getContentHandler();
32  prevErrorHandler = parser->getErrorHandler();
33 
34  parser->setContentHandler(this);
35  parser->setErrorHandler(this);
36 
37  generalHandler = NULL;
38  multipleValuesHandler = NULL;
39  ignoreHandler = NULL;
40 
41 }
42 
43 IsisXMLList::~IsisXMLList() {
44 
45  if(generalHandler) delete generalHandler;
46  if(multipleValuesHandler != NULL) delete multipleValuesHandler;
47  if(ignoreHandler != NULL) delete ignoreHandler;
48 }
49 
50 
51 // IsisXMLList: Overrides of the SAX DocumentHandler interface
52 void IsisXMLList::characters(const XMLCh *const chars,
53  const XMLSize_t length) {
54 }
55 
56 
57 void IsisXMLList::endElement(const XMLCh *const uri,
58  const XMLCh *const localname,
59  const XMLCh *const qname) {
60  parser->setContentHandler(prevDocHandler);
61  parser->setErrorHandler(prevErrorHandler);
62 }
63 
64 void IsisXMLList::startElement(const XMLCh *const uri,
65  const XMLCh *const localname,
66  const XMLCh *const qname,
67  const XERCES::Attributes &attributes) {
68 
69  if((string)XERCES::XMLString::transcode(localname) == (string)"brief") {
70  if(generalHandler != NULL) {
71  delete generalHandler;
72  generalHandler = NULL;
73  }
74  generalHandler = new IsisXMLHandler(encodingName, expandNamespaces, parser,
75  &list->brief);
76  }
77  else if((string)XERCES::XMLString::transcode(localname) == (string)"description") {
78  if(generalHandler != NULL) {
79  delete generalHandler;
80  generalHandler = NULL;
81  }
82  generalHandler = new IsisXMLHandler(encodingName, expandNamespaces, parser,
83  &list->description);
84  }
85  else if((string)XERCES::XMLString::transcode(localname) == (string)"exclusions") {
86  if(multipleValuesHandler != NULL) {
87  delete multipleValuesHandler;
88  multipleValuesHandler = NULL;
89  }
90  multipleValuesHandler =
91  new IsisXMLMultipleValues(encodingName, expandNamespaces,
92  parser, &list->exclude);
93  }
94  else if((string)XERCES::XMLString::transcode(localname) == (string)"inclusions") {
95  if(multipleValuesHandler != NULL) {
96  delete multipleValuesHandler;
97  multipleValuesHandler = NULL;
98  }
99  multipleValuesHandler =
100  new IsisXMLMultipleValues(encodingName, expandNamespaces,
101  parser, &list->include);
102  }
103  else {
104  if(ignoreHandler != NULL) {
105  delete ignoreHandler;
106  ignoreHandler = NULL;
107  }
108  ignoreHandler =
109  new IsisXMLIgnore(encodingName, expandNamespaces, parser,
110  (string)XERCES::XMLString::transcode(localname));
111  }
112 
113 
114 
115 
116 }
IsisXMLHandler
This is free and unencumbered software released into the public domain.
Definition: IsisXMLHandler.h:18
std
Namespace for the standard library.
IsisListOptionData
This is free and unencumbered software released into the public domain.
Definition: IsisAmlData.h:19
IsisXMLIgnore
This is free and unencumbered software released into the public domain.
Definition: IsisXMLIgnore.h:18
IsisXMLMultipleValues
This is free and unencumbered software released into the public domain.
Definition: IsisXMLMultipleValues.h:18

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:16:43