67 #include <libxml/xmlmemory.h> 68 #include <libxml/tree.h> 69 #include <libxml/debugXML.h> 70 #include <libxml/encoding.h> 109 #define NUMBER_OF_ELEMENTS sizeof(sl_elements)/sizeof(sl_elements[0]) 117 {
"action",
"execute-low", 0x05 },
118 {
"action",
"execute-high", 0x06 },
119 {
"action",
"cache", 0x07 },
120 {
"href",
"http://", 0x09 },
121 {
"href",
"http://www.", 0x0a },
122 {
"href",
"https://", 0x0b },
123 {
"href",
"https://www.", 0x0c },
124 {
"href", NULL, 0x08 }
127 #define NUMBER_OF_ATTRIBUTES sizeof(sl_attributes)/sizeof(sl_attributes[0]) 141 #define NUMBER_OF_URL_VALUES sizeof(sl_url_values)/sizeof(sl_url_values[0]) 154 static int url(
int hex);
155 static int action(
int hex);
178 pDoc = xmlParseMemory(sl_c_text,
size);
189 error(0,
"SL: No document to parse. Probably an error in SL source");
211 (**slbxml).wbxml_version = 0x02;
212 (**slbxml).public_id = 0x06;
218 node = xmlDocGetRootElement(document);
236 switch (node->type) {
237 case XML_ELEMENT_NODE:
241 case XML_COMMENT_NODE:
250 error(0,
"SL COMPILER: Unknown XML node in the SL source.");
262 if (node->children != NULL)
267 if (node->children != NULL)
276 warning(0,
"SL compiler: undefined return value in a parse function.");
281 if (node->next != NULL)
301 unsigned char status_bits,
304 xmlAttrPtr attribute;
320 sl_hex = sl_hex | status_bits;
332 sl_hex = sl_hex | status_bits;
341 if (node->properties != NULL) {
342 attribute = node->properties;
343 while (attribute != NULL) {
345 attribute = attribute->next;
359 unsigned char sl_hex;
365 if (attr->children != NULL)
378 debug(
"wap.push.sl.compiler", 0,
"value part was NULL");
392 warning(0,
"unknown attribute in SL source");
399 }
else if (
url(sl_hex)) {
425 switch ((
unsigned char) hex) {
427 case 0x09:
case 0x0b:
428 case 0x0a:
case 0x0c:
442 switch ((
unsigned char) hex) {
443 case 0x05:
case 0x06:
464 size_t first_part_len;
void error(int err, const char *fmt,...)
static int parse_element(xmlNodePtr node, simple_binary_t **slbxml)
int sl_compile(Octstr *sl_doc, Octstr *charset, Octstr **sl_binary)
static int action(int hex)
static sl_3table_t sl_attributes[]
void output_octet_string(Octstr *os, simple_binary_t **sibxml)
unsigned char element_check_content(xmlNodePtr node)
static int parse_document(xmlDocPtr document, Octstr *charset, simple_binary_t **slbxml)
long octstr_search(const Octstr *haystack, const Octstr *needle, long pos)
void octstr_strip_blanks(Octstr *text)
#define octstr_get_cstr(ostr)
#define NUMBER_OF_ATTRIBUTES
void simple_binary_destroy(simple_binary_t *binary)
void parse_inline_string(Octstr *temp, simple_binary_t **binary)
#define NUMBER_OF_URL_VALUES
Octstr * octstr_imm(const char *cstr)
static int parse_node(xmlNodePtr node, simple_binary_t **slbxml)
int parse_charset(Octstr *os)
static sl_2table_t sl_url_values[]
void octstr_delete(Octstr *ostr1, long pos, long len)
static sl_2table_t sl_elements[]
int octstr_ncompare(const Octstr *ostr1, const Octstr *ostr2, long n)
#define octstr_duplicate(ostr)
void warning(int err, const char *fmt,...)
void octstr_destroy(Octstr *ostr)
#define octstr_create(cstr)
static void parse_url_value(Octstr *value, simple_binary_t **slbxml)
long octstr_len(const Octstr *ostr)
void simple_binary_output(Octstr *os, simple_binary_t *binary)
void debug(const char *place, int err, const char *fmt,...)
void set_charset(Octstr *document, Octstr *charset)
void parse_end(simple_binary_t **binary)
static int parse_attribute(xmlAttrPtr attr, simple_binary_t **slbxml)
void output_char(int byte, simple_binary_t **binary)
#define WBXML_CONTENT_BIT
#define create_octstr_from_node(node)
simple_binary_t * simple_binary_create(void)
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)