Aleksey Sanin support for c14n 1.1
* c14n.c include/libxml/c14n.h: adds support for C14N 1.1,
new flags at the API level
* runtest.c Makefile.am testC14N.c xmllint.c: add support in CLI
tools and test binaries
* result/c14n/1-1-without-comments/* test/c14n/1-1-without-comments/*:
add a new batch of tests
diff --git a/testC14N.c b/testC14N.c
index 674fc71..ba70127 100644
--- a/testC14N.c
+++ b/testC14N.c
@@ -32,13 +32,17 @@
name);
fprintf(stderr, "where <mode> is one of following:\n");
fprintf(stderr,
- "--with-comments \t XML file canonization w comments\n");
+ "--with-comments \t XML file canonicalization v1.0 w comments \n");
fprintf(stderr,
- "--without-comments \t XML file canonization w/o comments\n");
+ "--without-comments \t XML file canonicalization v1.0 w/o comments\n");
fprintf(stderr,
- "--exc-with-comments \t Exclusive XML file canonization w comments\n");
+ "--1-1-with-comments \t XML file canonicalization v1.1 w comments\n");
fprintf(stderr,
- "--exc-without-comments\t Exclusive XML file canonization w/o comments\n");
+ "--1-1-without-comments \t XML file canonicalization v1.1 w/o comments\n");
+ fprintf(stderr,
+ "--exc-with-comments \t Exclusive XML file canonicalization v1.0 w comments\n");
+ fprintf(stderr,
+ "--exc-without-comments\t Exclusive XML file canonicalization v1.0 w/o comments\n");
}
static xmlXPathObjectPtr
@@ -49,7 +53,7 @@
/* static void print_xpath_nodes(xmlNodeSetPtr nodes); */
static int
-test_c14n(const char* xml_filename, int with_comments, int exclusive,
+test_c14n(const char* xml_filename, int with_comments, int mode,
const char* xpath_filename, xmlChar **inclusive_namespaces) {
xmlDocPtr doc;
xmlXPathObjectPtr xpath = NULL;
@@ -96,7 +100,7 @@
/* fprintf(stderr,"File \"%s\" loaded: start canonization\n", xml_filename); */
ret = xmlC14NDocDumpMemory(doc,
(xpath) ? xpath->nodesetval : NULL,
- exclusive, inclusive_namespaces,
+ mode, inclusive_namespaces,
with_comments, &result);
if(ret >= 0) {
if(result != NULL) {
@@ -135,22 +139,26 @@
fprintf(stderr, "Error: wrong number of arguments.\n");
usage(argv[0]);
} else if(strcmp(argv[1], "--with-comments") == 0) {
- ret = test_c14n(argv[2], 1, 0, (argc > 3) ? argv[3] : NULL, NULL);
+ ret = test_c14n(argv[2], 1, XML_C14N_1_0, (argc > 3) ? argv[3] : NULL, NULL);
} else if(strcmp(argv[1], "--without-comments") == 0) {
- ret = test_c14n(argv[2], 0, 0, (argc > 3) ? argv[3] : NULL, NULL);
+ ret = test_c14n(argv[2], 0, XML_C14N_1_0, (argc > 3) ? argv[3] : NULL, NULL);
+ } else if(strcmp(argv[1], "--1-1-with-comments") == 0) {
+ ret = test_c14n(argv[2], 1, XML_C14N_1_1, (argc > 3) ? argv[3] : NULL, NULL);
+ } else if(strcmp(argv[1], "--1-1-without-comments") == 0) {
+ ret = test_c14n(argv[2], 0, XML_C14N_1_1, (argc > 3) ? argv[3] : NULL, NULL);
} else if(strcmp(argv[1], "--exc-with-comments") == 0) {
xmlChar **list;
/* load exclusive namespace from command line */
list = (argc > 4) ? parse_list((xmlChar *)argv[4]) : NULL;
- ret = test_c14n(argv[2], 1, 1, (argc > 3) ? argv[3] : NULL, list);
+ ret = test_c14n(argv[2], 1, XML_C14N_EXCLUSIVE_1_0, (argc > 3) ? argv[3] : NULL, list);
if(list != NULL) xmlFree(list);
} else if(strcmp(argv[1], "--exc-without-comments") == 0) {
xmlChar **list;
/* load exclusive namespace from command line */
list = (argc > 4) ? parse_list((xmlChar *)argv[4]) : NULL;
- ret = test_c14n(argv[2], 0, 1, (argc > 3) ? argv[3] : NULL, list);
+ ret = test_c14n(argv[2], 0, XML_C14N_EXCLUSIVE_1_0, (argc > 3) ? argv[3] : NULL, list);
if(list != NULL) xmlFree(list);
} else {
fprintf(stderr, "Error: bad option.\n");