summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Revyakin <vadimr@intel.com>2007-01-18 13:37:20 +0000
committerVadim Revyakin <vadimr@intel.com>2007-01-18 13:37:20 +0000
commit2f6f1831ed8ee51aeb1e5efbb812d05405cdd159 (patch)
treeea2d04a31f629b3ee8697584ce19ce0791d92ce0
parent4cedec3b53681c2bd9f1d9c9831c7b0a3c92114c (diff)
downloadwsmancli-2f6f1831ed8ee51aeb1e5efbb812d05405cdd159.tar.gz
wsmancli-2f6f1831ed8ee51aeb1e5efbb812d05405cdd159.tar.xz
wsmancli-2f6f1831ed8ee51aeb1e5efbb812d05405cdd159.zip
deserialization nodes with attributes
-rw-r--r--examples/serialize.c67
1 files changed, 65 insertions, 2 deletions
diff --git a/examples/serialize.c b/examples/serialize.c
index 1461ad0..716cc81 100644
--- a/examples/serialize.c
+++ b/examples/serialize.c
@@ -708,10 +708,73 @@ example6()
node = ws_xml_get_doc_root(doc);
retval = ws_serialize(cntx, node, &sample, Sample_TypeInfo,
- CLASSNAME, NULL, NULL, 0);
+ CLASSNAME, XML_NS_WS_MAN, XML_NS_ADDRESSING, 0);
printf("\n\nws_serialize: %d\n", retval);
ws_xml_dump_node_tree(stdout, node);
-}
+
+ Sample *news;
+ printf("\n\nws_deserialize:\n");
+ news = (Sample *)ws_deserialize(cntx,
+ node,
+ Sample_TypeInfo,
+ CLASSNAME,
+ XML_NS_ADDRESSING, XML_NS_ADDRESSING,
+ 0, 0);
+ if (news == NULL) {
+ printf("Errror ws_deserialize\n");
+ return;
+ }
+
+ XML_NODE_ATTR *nattrs;
+ Dummy *dm = &(news->struct_with_attrs.body);
+ printf("**** Deserialized document %p *****\n", news);
+ printf("struct_with_attrs.body (");
+ nattrs = news->struct_with_attrs.attrs;
+ while (nattrs) {
+ printf("%s:%s=\"%s\" ", nattrs->ns, nattrs->name, nattrs->value);
+ nattrs = nattrs->next;
+ }
+ printf(")\n");
+
+ printf(" uint8_with_attrs = %d (", dm->uint8_with_attrs.body);
+ nattrs = dm->uint8_with_attrs.attrs;
+ while (nattrs) {
+ printf("%s:%s=\"%s\" ", nattrs->ns, nattrs->name, nattrs->value);
+ nattrs = nattrs->next;
+ }
+ printf(")\n");
+
+ printf(" uint16_with_attrs = %d (", dm->uint16_with_attrs.body);
+ nattrs = dm->uint16_with_attrs.attrs;
+ while (nattrs) {
+ printf("%s:%s=\"%s\" ", nattrs->ns, nattrs->name, nattrs->value);
+ nattrs = nattrs->next;
+ }
+ printf(")\n");
+
+ printf(" uint32_with_attrs = %d (", dm->uint32_with_attrs.body);
+ nattrs = dm->uint32_with_attrs.attrs;
+ while (nattrs) {
+ printf("%s:%s=\"%s\" ", nattrs->ns, nattrs->name, nattrs->value);
+ nattrs = nattrs->next;
+ }
+ printf(")\n");
+
+ printf(" bool_with_attrs = %d (", dm->bool_with_attrs.body);
+ nattrs = dm->bool_with_attrs.attrs;
+ while (nattrs) {
+ printf("%s:%s=\"%s\" ", nattrs->ns, nattrs->name, nattrs->value);
+ nattrs = nattrs->next;
+ }
+ printf(")\n");
+
+ printf(" str_with_attrs = %s (", dm->str_with_attrs.body);
+ nattrs = dm->str_with_attrs.attrs;
+ while (nattrs) {
+ printf("%s:%s=\"%s\" ", nattrs->ns, nattrs->name, nattrs->value);
+ nattrs = nattrs->next;
+ }
+ printf(")\n");}