--- xml-int32.c 2001/07/24 14:23:16 1.2
+++ xml-int32.c 2001/07/31 15:26:21 1.3
@@ -58,11 +58,18 @@
printf("Failed to initialize XDS context.\n");
return 1;
}
- if (xds_register(xds, "int", &xml_encode_int32, NULL) != XDS_OK)
+ if (xds_register(xds, "begin", &xml_encode_begin, NULL) != XDS_OK ||
+ xds_register(xds, "end", &xml_encode_end, NULL) != XDS_OK ||
+ xds_register(xds, "int", &xml_encode_int32, NULL) != XDS_OK)
{
printf("Failed to register my encoding engines.\n");
return 1;
}
+ if (xds_encode(xds, "begin") != XDS_OK)
+ {
+ printf("xds_encode_begin() failed!\n");
+ return 1;
+ }
for (i = 0; i < sizeof(values)/sizeof(xds_int32_t); ++i)
{
if (xds_encode(xds, "int", values[i]) != XDS_OK)
@@ -71,6 +78,11 @@
return 1;
}
}
+ if (xds_encode(xds, "end") != XDS_OK)
+ {
+ printf("xds_encode_end() failed!\n");
+ return 1;
+ }
if (xds_getbuffer(xds, XDS_GIFT, (void**)&buffer, &buffer_size) != XDS_OK)
{
printf("getbuffer() failed.\n");
@@ -84,7 +96,9 @@
printf("Failed to initialize XDS context.\n");
return 1;
}
- if (xds_register(xds, "int", &xml_decode_int32, NULL) != XDS_OK)
+ if (xds_register(xds, "begin", &xml_decode_begin, NULL) != XDS_OK ||
+ xds_register(xds, "end", &xml_decode_end, NULL) != XDS_OK ||
+ xds_register(xds, "int", &xml_decode_int32, NULL) != XDS_OK)
{
printf("Failed to register my decoding engines.\n");
return 1;
@@ -94,6 +108,11 @@
printf("setbuffer() failed.\n");
return 1;
}
+ if (xds_decode(xds, "begin") != XDS_OK)
+ {
+ printf("xds_decode_begin() failed!\n");
+ return 1;
+ }
for (i = 0; i < sizeof(values)/sizeof(xds_int32_t); ++i)
{
xds_int32_t val;
@@ -108,6 +127,11 @@
return 1;
}
}
+ if (xds_decode(xds, "end") != XDS_OK)
+ {
+ printf("xds_decode_end() failed!\n");
+ return 1;
+ }
xds_destroy(xds);
/* Everything went fine. */
|