diff options
author | William M. Brack <wbrack@src.gnome.org> | 2003-07-31 14:47:38 +0000 |
---|---|---|
committer | William M. Brack <wbrack@src.gnome.org> | 2003-07-31 14:47:38 +0000 |
commit | 78637da0ea1c833dfdfad87a9aa5bea14510d08a (patch) | |
tree | 0c9606860467cea6cadf70f7f40bd6bedabe239e /xmllint.c | |
parent | 97e018861b5708c38556365af8268261c4d5e2ab (diff) | |
download | libxml2-78637da0ea1c833dfdfad87a9aa5bea14510d08a.tar.gz |
fixing bug 118559
Diffstat (limited to 'xmllint.c')
-rw-r--r-- | xmllint.c | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -145,7 +145,6 @@ static int stream = 0; static int chkregister = 0; static const char *output = NULL; - /* * Internal timing routines to remove the necessity to have unix-specific * function calls @@ -755,6 +754,31 @@ static void parseAndPrintFile(char *filename) { } #endif #ifdef LIBXML_HTML_ENABLED + else if ((html) && (push)) { + FILE *f; + + f = fopen(filename, "r"); + if (f != NULL) { + int res, size = 3; + char chars[4096]; + htmlParserCtxtPtr ctxt; + + /* if (repeat) */ + size = 4096; + res = fread(chars, 1, 4, f); + if (res > 0) { + ctxt = htmlCreatePushParserCtxt(NULL, NULL, + chars, res, filename, 0); + while ((res = fread(chars, 1, size, f)) > 0) { + htmlParseChunk(ctxt, chars, res, 0); + } + htmlParseChunk(ctxt, chars, 0, 1); + doc = ctxt->myDoc; + htmlFreeParserCtxt(ctxt); + } + fclose(f); + } + } else if (html) { doc = htmlParseFile(filename, NULL); } |