00001
00020 #ifndef INCL_XML_PROCESSOR
00021 #define INCL_XML_PROCESSOR
00022
00024 #include "base/fscapi.h"
00025 #include "base/util/StringBuffer.h"
00026 #include "base/util/KeyValuePair.h"
00027 #include "base/util/ArrayList.h"
00028
00029 #define DIM_TAG 32
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 class XMLProcessor {
00040
00041 public:
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 static char* copyElementContent(const char* xml, const char* tag, unsigned int* pos = NULL) EXTRA_SECTION_00;
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 static const char* getElementContent(const char* xml, const char* tag,
00067 unsigned int* pos, unsigned int* startPos, unsigned int* endPos) EXTRA_SECTION_00;
00068
00069
00070
00071
00072 static int countElementTag(const char* xml, const char* tag) EXTRA_SECTION_00;
00073
00074 static int countAnd(const char* token) EXTRA_SECTION_00;
00075
00076 static int countChar(const char* token, const char* element) EXTRA_SECTION_00;
00077
00078 static const char* getNextTag(const char* xml, int* pos);
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 static char* copyElementContentExcept(const char* xml ,
00103 const char* tag ,
00104 const char* except ,
00105 unsigned int* pos) EXTRA_SECTION_00;
00106
00107 static char* copyElementContentLevel(const char* xml,
00108 const char* tag,
00109 unsigned int* pos,
00110 int lev = 0 ,
00111 int* startLevel = NULL) EXTRA_SECTION_00;
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 static char* copyContent(const char* xml, unsigned int startPos, unsigned int endPos) EXTRA_SECTION_00;
00126
00133
00134
00142 static StringBuffer makeElement(const char* tag,
00143 const char* val,
00144 const char* attr = NULL) EXTRA_SECTION_00;
00145
00153 static StringBuffer makeElement(const char* tag,
00154 const char* val,
00155 ArrayList attrList) EXTRA_SECTION_00;
00156
00160 static StringBuffer makeElement(const char* tag, bool val) {
00161 return makeElement( tag, (val?"true":"false") ) EXTRA_SECTION_00 ;
00162 }
00163
00167 static StringBuffer makeElement(const char* tag, int val) {
00168 return makeElement( tag, StringBuffer().append(val) ) EXTRA_SECTION_00 ;
00169 }
00170
00183 static const char* getElementAttributes(
00184 const char* xml,
00185 const char* tag,
00186 unsigned int* startPos,
00187 unsigned int* endPos,
00188 bool escaped = false) EXTRA_SECTION_00;
00189
00190 };
00191
00193 #endif
00194