summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2004-12-08 10:00:35 +0000
committerFrederic Peters <fpeters@entrouvert.com>2004-12-08 10:00:35 +0000
commit03545f18382e16d46a0e1fdb3a3f5138229c0b2f (patch)
treeb1a60a18601bafff8e5025d651280b1f7d4051b9
parent7ece831c1ab98d5b1de28dd90befa72ecb6ac7b0 (diff)
new snippet type, SNIPPET_NODE_IN_CHILD, and documented all of the types.
-rw-r--r--docs/reference/snippet-types.rst62
-rw-r--r--lasso/xml/internals.h1
-rw-r--r--lasso/xml/xml.c17
3 files changed, 75 insertions, 5 deletions
diff --git a/docs/reference/snippet-types.rst b/docs/reference/snippet-types.rst
new file mode 100644
index 00000000..58adc7c9
--- /dev/null
+++ b/docs/reference/snippet-types.rst
@@ -0,0 +1,62 @@
+Snippet Types
+=============
+
+{ name, type, value }; assumes Name as name and Value as value in examples.
+
+SNIPPET_NODE
+
+ <Parent>
+ <Value/>
+ </Parent>
+
+
+SNIPPET_CONTENT
+
+ <Parent>
+ <Name>Value</Name>
+ </Parent>
+
+
+SNIPPET_TEXT_CHILD
+
+ <Parent>
+ Value
+ </Parent>
+
+
+SNIPPET_NAME_IDENTIFIER
+
+ (same result as SNIPPET_NODE)
+
+
+SNIPPET_ATTRIBUTE
+
+ <Parent Name="Value"/>
+
+
+SNIPPET_NODE_IN_CHILD
+
+ <Parent>
+ <Name>
+ <Value/>
+ </Name>
+ </Parent>
+
+
+SNIPPET_LIST_NODES
+
+ <Parent>
+ <Value-1/>
+ <Value-2/>
+ <Value-n/>
+ </Parent>
+
+
+SNIPPET_LIST_CONTENT
+
+ <Parent>
+ <Name>Value-1</Name>
+ <Name>Value-2</Name>
+ <Name>Value-n</Name>
+ </Parent>
+
diff --git a/lasso/xml/internals.h b/lasso/xml/internals.h
index 5850dd25..4cd85204 100644
--- a/lasso/xml/internals.h
+++ b/lasso/xml/internals.h
@@ -36,6 +36,7 @@ typedef enum {
SNIPPET_TEXT_CHILD,
SNIPPET_NAME_IDENTIFIER,
SNIPPET_ATTRIBUTE,
+ SNIPPET_NODE_IN_CHILD,
SNIPPET_LIST_NODES,
SNIPPET_LIST_CONTENT,
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index 6fce84ce..14818f7e 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -476,11 +476,15 @@ lasso_node_impl_init_from_xml(LassoNode *node, xmlNode *xmlnode)
continue;
if (type == SNIPPET_NODE) {
- LassoNode **location = value;
- LassoNode *n = lasso_node_new_from_xmlNode(t);
- *location = n;
- }
- else if (type == SNIPPET_CONTENT)
+ (*(LassoNode**)value) = lasso_node_new_from_xmlNode(t);
+ } else if (type == SNIPPET_NODE_IN_CHILD) {
+ xmlNode *t2 = t->children;
+ while (t2 && t2->type != XML_ELEMENT_NODE)
+ t2 = t2->next;
+ if (t2)
+ (*(LassoNode**)value) =
+ lasso_node_new_from_xmlNode(t2);
+ } else if (type == SNIPPET_CONTENT)
(*(char**)value) = xmlNodeGetContent(t);
else if (type == SNIPPET_NAME_IDENTIFIER)
(*(LassoSamlNameIdentifier**)value) =
@@ -1040,6 +1044,9 @@ lasso_node_build_xmlNode_from_snippets(LassoNode *node, xmlNode *xmlnode,
xmlNodeSetName(t, snippet->name);
xmlSetNs(t, xmlns);
break;
+ case SNIPPET_NODE_IN_CHILD:
+ t = xmlNewTextChild(xmlnode, NULL, snippet->name, NULL);
+ xmlAddChild(t, lasso_node_get_xmlNode(LASSO_NODE(value)));
case SNIPPET_LIST_NODES:
elem = (GList *)value;
while (elem) {