Tag
Hash :
be803967
Author :
Date :
2000-06-28T23:40:59
- Large resync between W3C and Gnome tree - configure.in: 2.1.0 prerelease - example/Makefile.am example/gjobread.c tree.h: work on libxml1 libxml2 convergence. - nanoftp, nanohttp.c: fixed stalled connections probs - HTMLtree.c SAX.c : support for attribute without values in HTML for andersca - valid.c: Fixed most validation + namespace problems - HTMLparser.c: start document callback for andersca - debugXML.c xpath.c: lots of XPath fixups from Picdar Technology - parser.h, SAX.c: serious speed improvement for large CDATA blocks - encoding.[ch] xmlIO.[ch]: Improved seriously saving to different encoding - config.h.in parser.c xmllint.c: added xmlCheckVersion() and the LIBXML_TEST_VERSION macro Daniel
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
/*
* testURI.c : a small tester program for XML input.
*
* See Copyright for the status of this software.
*
* Daniel.Veillard@w3.org
*/
#ifdef WIN32
#include "win32config.h"
#else
#include "config.h"
#endif
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlmemory.h>
#include <libxml/uri.h>
int main(int argc, char **argv) {
int i, ret, arg = 1;
xmlURIPtr uri;
const char *base = NULL;
xmlChar *composite;
if ((!strcmp(argv[arg], "-base")) || (!strcmp(argv[arg], "--base"))) {
arg++;
base = argv[arg];
if (base != NULL)
arg++;
}
uri = xmlCreateURI();
if (argv[arg] == NULL) {
char str[1024];
while (1) {
/*
* read one line in string buffer.
*/
if (fgets (&str[0], sizeof (str) - 1, stdin) == NULL)
break;
/*
* remove the ending spaces
*/
i = strlen(str);
while ((i > 0) &&
((str[i - 1] == '\n') || (str[i - 1] == '\r') ||
(str[i - 1] == ' ') || (str[i - 1] == '\t'))) {
i--;
str[i] = 0;
}
if (i <= 0)
continue;
ret = xmlParseURIReference(uri, str);
if (ret != 0)
printf("%s : error %d\n", str, ret);
else {
xmlPrintURI(stdout, uri);
printf("\n");
}
}
} else {
while (argv[arg] != NULL) {
if (base == NULL) {
ret = xmlParseURIReference(uri, argv[arg]);
if (ret != 0)
printf("%s : error %d\n", argv[arg], ret);
else {
xmlPrintURI(stdout, uri);
printf("\n");
}
} else {
composite = xmlBuildURI((xmlChar *)argv[arg], (xmlChar *) base);
if (base == NULL) {
} else {
printf("%s\n", composite);
xmlFree(composite);
}
}
arg++;
}
}
xmlFreeURI(uri);
xmlMemoryDump();
exit(0);
}