/*
* Canonical XML implementation test program
*
* See Copyright for the status of this software.
*
* Author: Aleksey Sanin <aleksey@aleksey.com>
*/
#include "libxml.h"
#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
#include <stdio.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <libxml/xmlmemory.h>
#include <libxml/xpathInternals.h>
"Usage: %s <mode> <xml-file> [<xpath-expr>] [<inclusive-ns-list>]\n",
name);
"--with-comments \t XML file canonization w comments\n");
"--without-comments \t XML file canonization w/o comments\n");
"--exc-with-comments \t Exclusive XML file canonization w comments\n");
"--exc-without-comments\t Exclusive XML file canonization w/o comments\n");
}
static xmlXPathObjectPtr
/* static void print_xpath_nodes(xmlNodeSetPtr nodes); */
static int
int ret;
/*
* build an XML tree from a the file; we need to add default
* attributes and resolve all character and entities references
*/
return(-1);
}
/*
* Check the document is of the right kind
*/
return(-1);
}
/*
* load xpath file if specified
*/
if(xpath_filename) {
return(-1);
}
}
/*
* Canonical form
*/
/* fprintf(stderr,"File \"%s\" loaded: start canonization\n", xml_filename); */
with_comments, &result);
if(ret >= 0) {
}
} else {
return(-1);
}
/*
* Cleanup
*/
return(ret);
}
/*
* Init libxml
*/
/*
* Parse command line and process file
*/
if( argc < 3 ) {
/* load exclusive namespace from command line */
/* load exclusive namespace from command line */
} else {
}
/*
* Shutdown libxml
*/
return((ret >= 0) ? 0 : 1);
}
/*
* Macro used to grow the current buffer.
*/
#define growBufferReentrant() { \
buffer_size *= 2; \
perror("realloc failed"); \
return(NULL); \
} \
}
static xmlChar **
int buffer_size = 0;
int len;
return(NULL);
}
str++;
len -= 2;
}
/*
* allocate an translation buffer.
*/
buffer_size = 1000;
perror("malloc failed");
return(NULL);
}
while(*str != '\0') {
}
}
return buffer;
}
static xmlXPathObjectPtr
/*
* load XPath expr as a file
*/
return(NULL);
}
/*
* Check the document is of the right kind
*/
return(NULL);
}
}
return(NULL);
}
return(NULL);
}
return(NULL);
}
/*
* Register namespaces
*/
fprintf(stderr,"Error: unable to register NS with prefix=\"%s\" and href=\"%s\"\n", ns->prefix, ns->href);
return(NULL);
}
}
/*
* Evaluate xpath
*/
return(NULL);
}
/* print_xpath_nodes(xpath->nodesetval); */
return(xpath);
}
/*
static void
print_xpath_nodes(xmlNodeSetPtr nodes) {
xmlNodePtr cur;
int i;
if(nodes == NULL ){
fprintf(stderr, "Error: no nodes set defined\n");
return;
}
fprintf(stderr, "Nodes Set:\n-----\n");
for(i = 0; i < nodes->nodeNr; ++i) {
if(nodes->nodeTab[i]->type == XML_NAMESPACE_DECL) {
xmlNsPtr ns;
ns = (xmlNsPtr)nodes->nodeTab[i];
cur = (xmlNodePtr)ns->next;
fprintf(stderr, "namespace \"%s\"=\"%s\" for node %s:%s\n",
ns->prefix, ns->href,
(cur->ns) ? cur->ns->prefix : BAD_CAST "", cur->name);
} else if(nodes->nodeTab[i]->type == XML_ELEMENT_NODE) {
cur = nodes->nodeTab[i];
fprintf(stderr, "element node \"%s:%s\"\n",
(cur->ns) ? cur->ns->prefix : BAD_CAST "", cur->name);
} else {
cur = nodes->nodeTab[i];
fprintf(stderr, "node \"%s\": type %d\n", cur->name, cur->type);
}
}
}
*/
#else
#include <stdio.h>
return(0);
}
#endif /* LIBXML_C14N_ENABLED */