#include "gwlib/gwlib.h"Include dependency graph for xml_shared.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | simple_binary_t |
Defines | |
| #define | create_octstr_from_node(node) (octstr_create(node->content)) |
Typedefs | |
| typedef charset_t | charset_t |
| typedef simple_binary_t | simple_binary_t |
Functions | |
| void | set_charset (Octstr *document, Octstr *charset) |
| Octstr * | find_charset_encoding (Octstr *document) |
| unsigned char | element_check_content (xmlNodePtr node) |
| int | only_blanks (const char *text) |
| int | parse_charset (Octstr *os) |
| List * | wml_charsets (void) |
| simple_binary_t * | simple_binary_create (void) |
| void | simple_binary_destroy (simple_binary_t *bxml) |
| void | simple_binary_output (Octstr *os, simple_binary_t *bxml) |
| void | parse_end (simple_binary_t **bxml) |
| void | output_char (int byte, simple_binary_t **bxml) |
| void | parse_octet_string (Octstr *os, simple_binary_t **bxml) |
| void | parse_inline_string (Octstr *temp, simple_binary_t **bxml) |
| void | output_octet_string (Octstr *os, simple_binary_t **bxml) |
|
|
Definition at line 141 of file xml_shared.h. |
|
|
Definition at line 71 of file xml_shared.h. |
|
|
Definition at line 77 of file xml_shared.h. |
|
|
Definition at line 242 of file xml_shared.c. References only_blanks(). Referenced by parse_element(), and parse_ota_syncsettings(). 00243 {
00244 unsigned char status_bits = 0x00;
00245
00246 if ((node->children != NULL) &&
00247 !((node->children->next == NULL) &&
00248 (node->children->type == XML_TEXT_NODE) &&
00249 (only_blanks((char *)node->children->content))))
00250 status_bits = WBXML_CONTENT_BIT;
00251
00252 if (node->properties != NULL)
00253 status_bits = status_bits | WBXML_ATTR_BIT;
00254
00255 return status_bits;
00256 }
|
Here is the call graph for this function:

|
|
Definition at line 145 of file xml_shared.c. References octstr_copy, octstr_destroy(), octstr_imm(), octstr_len(), octstr_search(), and octstr_strip_blanks(). Referenced by get_x_kannel_from_xml(), and normalize_charset(). 00146 {
00147 long gt = 0, enc = 0;
00148 Octstr *encoding = NULL, *temp = NULL;
00149
00150 enc = octstr_search(document, octstr_imm(" encoding="), 0);
00151 gt = octstr_search(document, octstr_imm("?>"), 0);
00152
00153 /* in case there is no encoding argument, assume always UTF-8 */
00154 if (enc < 0 || enc + 10 > gt)
00155 return NULL;
00156
00157 temp = octstr_copy(document, enc + 10, gt - (enc + 10));
00158 octstr_strip_blanks(temp);
00159 encoding = octstr_copy(temp, 1, octstr_len(temp) - 2);
00160 octstr_destroy(temp);
00161
00162 return encoding;
00163 }
|
Here is the call graph for this function:

|
|
Definition at line 171 of file xml_shared.c. References text. Referenced by element_check_content(), and parse_ota_syncsettings(). 00172 {
00173 int blank = 1;
00174 int j=0;
00175 int len = strlen(text);
00176
00177 while ((j<len) && blank) {
00178 blank = blank && isspace((int)text[j]);
00179 j++;
00180 }
00181
00182 return blank;
00183 }
|
|
||||||||||||
|
Definition at line 326 of file xml_shared.c. References octstr_append_char(). Referenced by parse_attribute(), parse_element(), parse_end(), parse_ota_syncsettings(), and parse_url_value(). 00327 {
00328 octstr_append_char((**binary).binary, byte);
00329 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 349 of file xml_shared.c. References octstr_insert(), and octstr_len(). Referenced by parse_attribute(), parse_element(), and parse_octet_string(). 00350 {
00351 octstr_insert((*sibxml)->binary, os, octstr_len((*sibxml)->binary));
00352 }
|
Here is the call graph for this function:

|
|
Definition at line 189 of file xml_shared.c. References character_sets, charset_t::charset, charset, gw_assert, charset_t::MIBenum, number, octstr_convert_range(), octstr_copy, octstr_destroy(), octstr_duplicate, octstr_len(), octstr_search_char(), octstr_str_compare(), and octstr_truncate(). Referenced by parse_document(). 00190 {
00191 Octstr *charset = NULL;
00192 Octstr *number = NULL;
00193 int i, j, cut = 0, ret = 0;
00194
00195 gw_assert(os != NULL);
00196 charset = octstr_duplicate(os);
00197
00198 /* The charset might be in lower case, so... */
00199 octstr_convert_range(charset, 0, octstr_len(charset), toupper);
00200
00201 /*
00202 * The character set is handled in two parts to make things easier.
00203 * The cutting.
00204 */
00205 if ((cut = octstr_search_char(charset, '_', 0)) > 0) {
00206 number = octstr_copy(charset, cut + 1, (octstr_len(charset) - (cut + 1)));
00207 octstr_truncate(charset, cut);
00208 }
00209 else if ((cut = octstr_search_char(charset, '-', 0)) > 0) {
00210 number = octstr_copy(charset, cut + 1, (octstr_len(charset) - (cut + 1)));
00211 octstr_truncate(charset, cut);
00212 }
00213
00214 /* And table search. */
00215 for (i = 0; character_sets[i].charset != NULL; i++)
00216 if (octstr_str_compare(charset, character_sets[i].charset) == 0) {
00217 for (j = i; octstr_str_compare(charset,
00218 character_sets[j].charset) == 0; j++)
00219 if (octstr_str_compare(number, character_sets[j].nro) == 0) {
00220 ret = character_sets[j].MIBenum;
00221 break;
00222 }
00223 break;
00224 }
00225
00226 /* UTF-8 is the default value */
00227 if (character_sets[i].charset == NULL)
00228 ret = character_sets[i-1].MIBenum;
00229
00230 octstr_destroy(number);
00231 octstr_destroy(charset);
00232
00233 return ret;
00234 }
|
Here is the call graph for this function:

|
|
Definition at line 321 of file xml_shared.c. References binary, output_char(), and WBXML_END. Referenced by parse_element(), and parse_node(). 00322 {
00323 output_char(WBXML_END, binary);
00324 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 339 of file xml_shared.c. References binary, octstr_destroy(), octstr_format(), octstr_format_append(), octstr_insert(), parse_octet_string(), WBXML_STR_END, and WBXML_STR_I. Referenced by parse_attribute(), parse_ota_syncsettings(), parse_text(), and parse_url_value(). 00340 {
00341 Octstr *startos;
00342
00343 octstr_insert(temp, startos = octstr_format("%c", WBXML_STR_I), 0);
00344 octstr_destroy(startos);
00345 octstr_format_append(temp, "%c", WBXML_STR_END);
00346 parse_octet_string(temp, binary);
00347 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 331 of file xml_shared.c. References binary, and output_octet_string(). Referenced by parse_cdata(), and parse_inline_string(). 00332 {
00333 output_octet_string(os, binary);
00334 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 111 of file xml_shared.c. References charset, charset_to_utf8(), octstr_append_data(), octstr_copy, octstr_create, octstr_delete(), octstr_destroy(), octstr_get_cstr, octstr_len(), octstr_search(), octstr_search_char(), and text. Referenced by ota_compile(), si_compile(), and sl_compile(). 00112 {
00113 long gt = 0, enc = 0;
00114 Octstr *encoding = NULL, *text = NULL, *temp = NULL;
00115
00116 if (octstr_len(charset) == 0)
00117 return;
00118
00119 encoding = octstr_create(" encoding");
00120 enc = octstr_search(document, encoding, 0);
00121 gt = octstr_search_char(document, '>', 0);
00122
00123 if (enc < 0 || enc > gt) {
00124 gt++;
00125 text = octstr_copy(document, gt, octstr_len(document) - gt);
00126 if (charset_to_utf8(text, &temp, charset) >= 0) {
00127 octstr_delete(document, gt, octstr_len(document) - gt);
00128 octstr_append_data(document, octstr_get_cstr(temp),
00129 octstr_len(temp));
00130 }
00131
00132 octstr_destroy(temp);
00133 octstr_destroy(text);
00134 }
00135
00136 octstr_destroy(encoding);
00137 }
|
Here is the call graph for this function:

|
|
Definition at line 284 of file xml_shared.c. References simple_binary_t::binary, binary, simple_binary_t::charset, octstr_create, simple_binary_t::public_id, and simple_binary_t::wbxml_version. Referenced by ota_compile(), si_compile(), and sl_compile(). 00285 {
00286 simple_binary_t *binary;
00287
00288 binary = gw_malloc(sizeof(simple_binary_t));
00289
00290 binary->wbxml_version = 0x00;
00291 binary->public_id = 0x00;
00292 binary->charset = 0x00;
00293 binary->binary = octstr_create("");
00294
00295 return binary;
00296 }
|
|
|
Definition at line 298 of file xml_shared.c. References simple_binary_t::binary, binary, and octstr_destroy(). Referenced by ota_compile(), si_compile(), and sl_compile(). 00299 {
00300 if (binary == NULL)
00301 return;
00302
00303 octstr_destroy(binary->binary);
00304 gw_free(binary);
00305 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 311 of file xml_shared.c. References simple_binary_t::binary, binary, simple_binary_t::charset, gw_assert, octstr_append_uintvar(), octstr_format_append(), octstr_len(), simple_binary_t::public_id, and simple_binary_t::wbxml_version. Referenced by ota_compile(), si_compile(), and sl_compile(). 00312 {
00313 gw_assert(octstr_len(os) == 0);
00314 octstr_format_append(os, "%c", binary->wbxml_version);
00315 octstr_format_append(os, "%c", binary->public_id);
00316 octstr_append_uintvar(os, binary->charset);
00317 octstr_format_append(os, "%c", 0x00);
00318 octstr_format_append(os, "%S", binary->binary);
00319 }
|
Here is the call graph for this function:

|
|
Definition at line 262 of file xml_shared.c. References character_sets, charset, charset_t::charset, gwlist_append(), gwlist_create, octstr_append(), octstr_append_char(), octstr_create, octstr_imm(), and result. Referenced by wap_appl_init(). 00263 {
00264 int i;
00265 List *result;
00266 Octstr *charset;
00267
00268 result = gwlist_create();
00269 for (i = 0; character_sets[i].charset != NULL; i++) {
00270 charset = octstr_create(character_sets[i].charset);
00271 octstr_append_char(charset, '-');
00272 octstr_append(charset, octstr_imm(character_sets[i].nro));
00273 gwlist_append(result, charset);
00274 }
00275
00276 return result;
00277 }
|
Here is the call graph for this function:
