diff options
| author | Frederic Peters <fpeters@entrouvert.com> | 2007-05-02 11:08:23 +0000 |
|---|---|---|
| committer | Frederic Peters <fpeters@entrouvert.com> | 2007-05-02 11:08:23 +0000 |
| commit | 7ec330821df2c6d986ba6e2f70edf5d38dce1dca (patch) | |
| tree | 98dd6fb2bd512f9ec764896fd79a20530c95d5ca | |
| parent | 63bab632c59fe5a0a4ae31e3e1035f58c1bcfe91 (diff) | |
| download | lasso-7ec330821df2c6d986ba6e2f70edf5d38dce1dca.tar.gz lasso-7ec330821df2c6d986ba6e2f70edf5d38dce1dca.tar.xz lasso-7ec330821df2c6d986ba6e2f70edf5d38dce1dca.zip | |
SNIPPET_LIST_NODES can now host LassoMiscTextNode, also useful now to directly
embed a text element (instead of a node with a text element as content)
| -rw-r--r-- | lasso/xml/misc_text_node.c | 11 | ||||
| -rw-r--r-- | lasso/xml/misc_text_node.h | 1 | ||||
| -rw-r--r-- | lasso/xml/xml.c | 17 | ||||
| -rw-r--r-- | swig/Lasso.i | 1 |
4 files changed, 25 insertions, 5 deletions
diff --git a/lasso/xml/misc_text_node.c b/lasso/xml/misc_text_node.c index 80afc3a4..7b72f82b 100644 --- a/lasso/xml/misc_text_node.c +++ b/lasso/xml/misc_text_node.c @@ -56,6 +56,10 @@ get_xmlNode(LassoNode *node, gboolean lasso_dump) { xmlNode *xmlnode; xmlNs *ns; + + if (LASSO_MISC_TEXT_NODE(node)->text_child) { + return xmlNewText((xmlChar*)(LASSO_MISC_TEXT_NODE(node)->content)); + } xmlnode = parent_class->get_xmlNode(node, lasso_dump); xmlNodeSetName(xmlnode, (xmlChar*)LASSO_MISC_TEXT_NODE(node)->name); @@ -72,6 +76,12 @@ init_from_xml(LassoNode *node, xmlNode *xmlnode) LassoMiscTextNode *n = LASSO_MISC_TEXT_NODE(node); int rc; + if (xmlnode->type == XML_TEXT_NODE) { + n->text_child = TRUE; + n->content = g_strdup((char*)(xmlnode->content)); + return 0; + } + rc = parent_class->init_from_xml(node, xmlnode); if (rc) return rc; @@ -107,6 +117,7 @@ instance_init(LassoMiscTextNode *node) node->name = NULL; node->ns_href = NULL; node->ns_prefix = NULL; + node->text_child = FALSE; } static void diff --git a/lasso/xml/misc_text_node.h b/lasso/xml/misc_text_node.h index 20f4a9f6..7a1847ff 100644 --- a/lasso/xml/misc_text_node.h +++ b/lasso/xml/misc_text_node.h @@ -61,6 +61,7 @@ struct _LassoMiscTextNode { char *name; char *ns_href; char *ns_prefix; + gboolean text_child; }; diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c index 525be3bb..a88cdeef 100644 --- a/lasso/xml/xml.c +++ b/lasso/xml/xml.c @@ -836,11 +836,18 @@ lasso_node_impl_init_from_xml(LassoNode *node, xmlNode *xmlnode) type = snippet->type & 0xff; value = G_STRUCT_MEMBER_P(node, snippet->offset); - if (type != SNIPPET_LIST_XMLNODES) - continue; - - location = value; - *location = g_list_append(*location, xmlCopyNode(t, 1)); + if (type == SNIPPET_LIST_XMLNODES) { + location = value; + *location = g_list_append( + *location, xmlCopyNode(t, 1)); + } else if (type == SNIPPET_LIST_NODES) { + LassoNode *text_node; + text_node = lasso_node_new_from_xmlNode_with_type(t, + "LassoMiscTextNode"); + location = value; + *location = g_list_append(*location, text_node); + } + continue; } continue; } diff --git a/swig/Lasso.i b/swig/Lasso.i index 485af408..e13e882f 100644 --- a/swig/Lasso.i +++ b/swig/Lasso.i @@ -1909,6 +1909,7 @@ typedef struct { char *name; char *ns_href; char *ns_prefix; + gboolean text_child; } LassoMiscTextNode; %extend LassoMiscTextNode { |
