casa
$Rev:20696$
|
00001 #ifndef STDCASAXMLUTILS_H 00002 #define STDCASAXMLUTILS_H 00003 00004 //* 00005 // What we are doing is encoding a parameter set 00006 // The parameter set <pset> has a "name" attribute that corresponds to 00007 // task, or tool.method, additional attributes specifies the scope, global, project, or local 00008 // if project, then an addtional project attribute, no scope attribute assume local 00009 // Then for each <param> we have the following attributes 00010 // "name", "xsi:type", and optionally "units" 00011 // Each parameter will then have the following elements 00012 // <value> can have attribute type="vector" 00013 // <description> short help text 00014 // <any> only if type is any 00015 // Description 00016 00017 #include <string> 00018 #include <xercesc/dom/DOM.hpp> 00019 #include <xmlcasa/variant.h> 00020 #include <xercesc/util/XMLChar.hpp> 00021 #include <xercesc/dom/DOM.hpp> 00022 #include <xercesc/framework/Wrapper4InputSource.hpp> 00023 00024 namespace casac { 00025 00026 using std::ostream; 00027 using std::string; 00028 00029 class record; 00030 00031 class stdcasaXMLUtil { 00032 public : 00033 stdcasaXMLUtil(); 00034 ~stdcasaXMLUtil(); 00035 bool toCasaRecord(record &outRec, const string &xml); 00036 bool fromCasaRecord(string &outXML, const record &theRecord); 00037 bool fromCasaRecord(ostream &outXML, const record &theRecord); 00038 bool readXMLFile(record &outRec, const string &xmlFile); 00039 bool writeXMLFile(const string &xmlFile, const record &inRec); 00040 void setRecord(record &aRec); 00041 private : 00042 bool readXML(record &outRec, const XERCES_CPP_NAMESPACE::Wrapper4InputSource &xml); 00043 variant *itsvalue(XERCES_CPP_NAMESPACE::DOMNode *theNode, variant::TYPE itsType); 00044 00045 XMLCh *name; 00046 XMLCh *type; 00047 //XMLCh *xsitype; 00048 XMLCh *param; 00049 XMLCh *value; 00050 XMLCh *allowed; 00051 XMLCh *range; 00052 XMLCh *description; 00053 XMLCh *mustexist; 00054 XMLCh *allowblank; 00055 XMLCh *ienum; 00056 XMLCh *kind; 00057 XMLCh *any; 00058 XMLCh *limittype; 00059 XMLCh *limittypes; 00060 XMLCh *units; 00061 XMLCh *shortdesc; 00062 XMLCh *example; 00063 XMLCh *subparam; 00064 XMLCh *ignorecase; 00065 00066 record *rangeRec; 00067 record *whenRec; 00068 record *equalsRec; 00069 record *constraintsRec; 00070 record *defaultsRec; 00071 record *paramSet; 00072 00073 string ttName; //Task or Tool Name 00074 string parmName; //Parameter Name 00075 string lastParm; // Last non-subparameter 00076 variant::TYPE setType(const string &xmlType); 00077 variant *tovariant(variant::TYPE theType, string &theInput, bool isVector); 00078 void addtovariant(variant *it, variant::TYPE theType, string &theInput); 00079 }; 00080 00081 } 00082 #endif