File wbxml2-0.9.2_SVN59-syncml-fix.diff of Package wbxml2
--- src/wbxml_tables.c
+++ src/wbxml_tables.c
@@ -1601,21 +1601,21 @@
#if defined( WBXML_SUPPORT_SYNCML )
const WBXMLNameSpaceEntry sv_syncml_syncml10_ns_table[] = {
- { "syncml:SYNCML1.0", 0x00 }, /**< Code Page 0: SYNCML1.0 */
+ { "SYNCML:SYNCML1.0", 0x00 }, /**< Code Page 0: SYNCML1.0 */
{ "syncml:metinf", 0x01 }, /**< Code Page 1: metinf */
{ NULL, 0x00 }
};
const WBXMLNameSpaceEntry sv_syncml_syncml11_ns_table[] = {
- { "syncml:SYNCML1.1", 0x00 }, /**< Code Page 0: SYNCML1.1 */
+ { "SYNCML:SYNCML1.1", 0x00 }, /**< Code Page 0: SYNCML1.1 */
{ "syncml:metinf", 0x01 }, /**< Code Page 1: metinf */
{ NULL, 0x00 }
};
const WBXMLNameSpaceEntry sv_syncml_syncml12_ns_table[] = {
- { "syncml:SYNCML1.2", 0x00 }, /**< Code Page 0: SYNCML1.2 */
+ { "SYNCML:SYNCML1.2", 0x00 }, /**< Code Page 0: SYNCML1.2 */
{ "syncml:metinf", 0x01 }, /**< Code Page 1: metinf */
{ NULL, 0x00 }
};
--- src/wbxml_tree.c
+++ src/wbxml_tree.c
@@ -250,7 +250,10 @@
}
else {
if ((ret = wbxml_tree_clb_ctx.error) != WBXML_OK)
+ {
+ WBXML_ERROR((WBXML_CONV, "xml2wbxml conversion failed - context error %i", ret));
wbxml_tree_destroy(wbxml_tree_clb_ctx.tree);
+ }
else
*tree = wbxml_tree_clb_ctx.tree;
}
@@ -840,10 +843,19 @@
{
/* Check <Type> value */
if ((tmp_node->children != NULL) && (tmp_node->children->type == WBXML_TREE_TEXT_NODE)) {
+ /* This function is used by wbxml and xml callbacks.
+ * So content types must be handled for both situations.
+ */
+
/* application/vnd.syncml-devinf+wbxml */
if (wbxml_buffer_compare_cstr(tmp_node->children->content, "application/vnd.syncml-devinf+wbxml") == 0) {
return WBXML_SYNCML_DATA_TYPE_WBXML;
}
+
+ /* application/vnd.syncml-devinf+xml */
+ if (wbxml_buffer_compare_cstr(tmp_node->children->content, "application/vnd.syncml-devinf+xml") == 0) {
+ return WBXML_SYNCML_DATA_TYPE_NORMAL;
+ }
/* text/clear */
if (wbxml_buffer_compare_cstr(tmp_node->children->content, "text/clear") == 0) {
--- src/wbxml_tree_clb_xml.c
+++ src/wbxml_tree_clb_xml.c
@@ -210,6 +210,16 @@
return;
}
+ /* Add doctype to give the XML parser a chance
+ * SyncML 1.2 is downward compatible to older versions.
+ */
+ if (!wbxml_buffer_insert_cstr(devinf_doc, "<!DOCTYPE DevInf PUBLIC '-//SYNCML//DTD DevInf 1.2//EN' 'http://www.openmobilealliance.org/tech/DTD/OMA-SyncML-Device_Information-DTD-1.2.dtd' >\n", 0))
+ {
+ tree_ctx->error = WBXML_ERROR_NOT_ENOUGH_MEMORY;
+ wbxml_buffer_destroy(devinf_doc);
+ return;
+ }
+
WBXML_DEBUG((WBXML_PARSER, "\t DevInf Doc : '%s'", wbxml_buffer_get_cstr(devinf_doc)));
/* Parse 'DevInf' Document */