summaryrefslogtreecommitdiffstats
path: root/lasso
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2008-11-03 14:15:43 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2008-11-03 14:15:43 +0000
commit770e3c5538b3cb69da76cae3c8fbe44e16f14f8e (patch)
tree59f8c4d70159bfbd537bb094402f32e30d615e31 /lasso
parent10156acfa832ffc0d4a8626be04411d1821862a8 (diff)
downloadlasso-770e3c5538b3cb69da76cae3c8fbe44e16f14f8e.tar.gz
lasso-770e3c5538b3cb69da76cae3c8fbe44e16f14f8e.tar.xz
lasso-770e3c5538b3cb69da76cae3c8fbe44e16f14f8e.zip
Add support for keep_xmlnode flag
* lasso/xml/xml.c: - (lasso_node_impl_init_from_xml) When the keep_xmlnode flag is true for the currently parsed Node class, we copy the parsed xmlNode and keep inside the LassoNode. - (lasso_node_dispose) if an original_xmlNode is present, we disallocate it.
Diffstat (limited to 'lasso')
-rw-r--r--lasso/xml/xml.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index a33d04d4..bdbb2725 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -979,6 +979,10 @@ lasso_node_impl_init_from_xml(LassoNode *node, xmlNode *xmlnode)
if (class->node_data == NULL || xmlnode == NULL)
return 0;
+ if (class->node_data->keep_xmlnode) {
+ lasso_assign_node(node->original_xmlNode, xmlnode);
+ }
+
while (class && LASSO_IS_NODE_CLASS(class) && class->node_data) {
for (t = xmlnode->children; t; t = t->next) {
@@ -1284,6 +1288,13 @@ lasso_node_dispose(GObject *object)
}
class = LASSO_NODE_GET_CLASS(object);
+
+ if (class && class->node_data && class->node_data->keep_xmlnode) {
+ LassoNode *node = LASSO_NODE(object);
+
+ lasso_release_node(node->original_xmlNode);
+ }
+
while (class && LASSO_IS_NODE_CLASS(class) && class->node_data) {
for (snippet = class->node_data->snippets; snippet && snippet->name; snippet++) {
void **value = G_STRUCT_MEMBER_P(object, snippet->offset);