From e2d034d3b56287f93a815147eff0f4e707b64774 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 27 Jul 1999 19:52:06 +0000 Subject: [PATCH] Bunch of updates, progressive parsing, updates on HTML, XPAth and docs, Daniel --- ChangeLog | 12 + HTMLparser.c | 293 ++-- Makefile.am | 1 + SAXresult/dav1 | 67 +- SAXresult/dav10 | 3 +- SAXresult/dav11 | 49 +- SAXresult/dav13 | 33 +- SAXresult/dav15 | 69 +- SAXresult/dav16 | 11 +- SAXresult/dav17 | 73 +- SAXresult/dav18 | 11 +- SAXresult/dav19 | 57 +- SAXresult/dav2 | 74 +- SAXresult/dav3 | 50 +- SAXresult/dav4 | 49 +- SAXresult/dav5 | 43 +- SAXresult/dav6 | 51 +- SAXresult/dav7 | 40 +- SAXresult/dav8 | 29 +- SAXresult/dav9 | 45 +- SAXresult/dia1 | 220 ++- SAXresult/dia2 | 220 ++- SAXresult/dtd1 | 1 - SAXresult/dtd10 | 7 +- SAXresult/dtd2 | 2 +- SAXresult/dtd3 | 2 +- SAXresult/dtd5 | 10 +- SAXresult/dtd6 | 7 +- SAXresult/dtd7 | 4 +- SAXresult/dtd8 | 4 +- SAXresult/dtd9 | 4 +- SAXresult/ent1 | 5 +- SAXresult/ent2 | 7 +- SAXresult/ent4 | 7 +- SAXresult/ent5 | 4 +- SAXresult/p3p | 44 +- SAXresult/rdf1 | 161 +- SAXresult/rdf2 | 266 +++- SAXresult/slashdot.rdf | 173 +-- SAXresult/slashdot.xml | 556 +++---- SAXresult/svg1 | 328 ++-- SAXresult/svg2 | 145 +- SAXresult/svg3 | 1841 +++++++++-------------- SAXresult/xml2 | 5 +- doc/html/gnome-xml-entities.html | 152 +- doc/html/gnome-xml-htmlparser.html | 214 ++- doc/html/gnome-xml-htmltree.html | 20 +- doc/html/gnome-xml-parser.html | 713 ++++++--- doc/html/gnome-xml-parserinternals.html | 424 +++--- doc/html/gnome-xml-tree.html | 917 +++++++---- doc/html/gnome-xml-valid.html | 191 ++- doc/html/gnome-xml-xml-error.html | 24 +- doc/html/gnome-xml-xpath.html | 98 +- doc/html/index.sgml | 5 +- encoding.c | 1 + include/libxml/parser.h | 8 + include/libxml/tree.h | 2 + include/libxml/xmlIO.h | 23 +- include/libxml/xpath.h | 3 +- parser.c | 655 ++++---- parser.h | 8 + result/XPath/tests/simpleabbr | 4 +- testSAX.c | 7 +- testXPath.c | 1 + tester.c | 20 +- tree.c | 65 +- tree.h | 2 + xmlIO.c | 321 ++++ xmlIO.h | 23 +- xpath.c | 196 +-- xpath.h | 3 +- 71 files changed, 4825 insertions(+), 4358 deletions(-) create mode 100644 xmlIO.c diff --git a/ChangeLog b/ChangeLog index f1b7ec30..5d1e2cb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Tue Jul 27 21:43:00 CEST 1999 Daniel Veillard + + * xpath.[ch] : improvements and debug of the XPath implementation + * parser.c, HTMLparser.c : modified the parsers to be progressive + * tree.[ch] : extended the Buffer promitives + * xmlIO.[ch] : added basic I/O routines providing progressive + parsing and ready for I18N conversion plugins + * SAXresult/* : the SAX callback sequence maybe slightly different + now + * test*.c : improved/updated the tests programs + * doc/* : recompiled the docs. + 1999-07-26 Michael Meeks * tree.h: Add const to 'content' in xmlNewDocNode, xmlNewChild diff --git a/HTMLparser.c b/HTMLparser.c index ce39a4be..6b08a224 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -33,6 +33,10 @@ #include "encoding.h" #include "valid.h" #include "parserInternals.h" +#include "xmlIO.h" + +#define HTML_MAX_NAMELEN 1000 +#define INPUT_CHUNK 50 /* #define DEBUG */ @@ -101,7 +105,6 @@ PUSH_AND_POP(xmlNodePtr, node) * UTF-8 if we are using this mode. It returns an int. * NEXT Skip to the next character, this does the proper decoding * in UTF-8 mode. It also pop-up unfinished entities on the fly. - * It returns the pointer to the current CHAR. * COPY(to) copy one char to *to, increment CUR_PTR and to accordingly */ @@ -111,21 +114,46 @@ PUSH_AND_POP(xmlNodePtr, node) #define NXT(val) ctxt->input->cur[(val)] #define UPP(val) (toupper(ctxt->input->cur[(val)])) #define CUR_PTR ctxt->input->cur +#define SHRINK xmlParserInputShrink(ctxt->input) +#define GROW xmlParserInputGrow(ctxt->input, INPUT_CHUNK) #define SKIP_BLANKS \ while (IS_BLANK(*(ctxt->input->cur))) NEXT #ifndef USE_UTF_8 #define CURRENT (*ctxt->input->cur) +#define NEXT { \ + if ((*ctxt->input->cur == 0) && \ + (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) { \ + xmlPopInput(ctxt); \ + } else { \ + if (*(ctxt->input->cur) == '\n') { \ + ctxt->input->line++; ctxt->input->col = 1; \ + } else ctxt->input->col++; \ + ctxt->input->cur++; \ + if (*ctxt->input->cur == 0) \ + xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \ + }} + +/**************************************** #define NEXT ((*ctxt->input->cur) ? \ (((*(ctxt->input->cur) == '\n') ? \ (ctxt->input->line++, ctxt->input->col = 1) : \ - (ctxt->input->col++)), ctxt->input->cur++) : \ - (ctxt->input->cur)) + (ctxt->input->col++)), \ + (ctxt->input->cur++), \ + ((*ctxt->input->cur) ? \ + (xmlParserInputGrow(ctxt->input, 100), \ + ctxt->input->cur): \ + (ctxt->input->cur))) : \ + ((xmlParserInputGrow(ctxt->input, 100) > 0) ? \ + ctxt->input->cur: \ + (xmlPopInput(ctxt), ctxt->input->cur))) + ****************************************/ #else #endif + /************************************************************************ * * * The list of HTML elements and their properties * @@ -803,7 +831,7 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len, CHAR *cur = NULL; htmlEntityDescPtr ent; - const CHAR *start = CUR_PTR; + int nbchars = 0; unsigned int max = (unsigned int) len; /* @@ -820,7 +848,7 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len, /* * Ok loop until we reach one of the ending char or a size limit. */ - while ((CUR_PTR - start < max) && (CUR != end) && + while ((nbchars < max) && (CUR != end) && (CUR != end2) && (CUR != end3)) { if (CUR == '&') { @@ -828,6 +856,7 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len, int val = htmlParseCharRef(ctxt); /* TODO: invalid for UTF-8 variable encoding !!! */ *out++ = val; + nbchars += 3; /* !!!! */ } else { ent = htmlParseEntityRef(ctxt, &name); if (name != NULL) { @@ -855,12 +884,14 @@ htmlDecodeEntities(htmlParserCtxtPtr ctxt, int len, out = &buffer[index]; } } + nbchars += 2 + xmlStrlen(name); free(name); } } } else { /* TODO: invalid for UTF-8 , use COPY(out); */ *out++ = CUR; + nbchars++; if (out - buffer > buffer_size - 100) { int index = out - buffer; @@ -1170,49 +1201,67 @@ htmlParseHTMLName(htmlParserCtxtPtr ctxt) { CHAR * htmlParseName(htmlParserCtxtPtr ctxt) { - const CHAR *q; - CHAR *ret = NULL; + CHAR buf[HTML_MAX_NAMELEN]; + int len = 0; - if (!IS_LETTER(CUR) && (CUR != '_') && - (CUR != ':')) return(NULL); - q = NEXT; + GROW; + if (!IS_LETTER(CUR) && (CUR != '_')) { + return(NULL); + } while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || (CUR == '.') || (CUR == '-') || (CUR == '_') || (CUR == ':') || (IS_COMBINING(CUR)) || - (IS_EXTENDER(CUR))) + (IS_EXTENDER(CUR))) { + buf[len++] = CUR; NEXT; - - ret = xmlStrndup(q, CUR_PTR - q); - - return(ret); + if (len >= HTML_MAX_NAMELEN) { + fprintf(stderr, + "htmlParseName: reached HTML_MAX_NAMELEN limit\n"); + while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || + (CUR == '.') || (CUR == '-') || + (CUR == '_') || (CUR == ':') || + (IS_COMBINING(CUR)) || + (IS_EXTENDER(CUR))) + NEXT; + break; + } + } + return(xmlStrndup(buf, len)); } /** * htmlParseHTMLAttribute: * @ctxt: an HTML parser context * - * parse an HTML Nmtoken. + * parse an HTML attribute value (without quotes). * * Returns the Nmtoken parsed or NULL */ CHAR * htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt) { - const CHAR *q; - CHAR *ret = NULL; - - q = NEXT; + CHAR buf[HTML_MAX_NAMELEN]; + int len = 0; + GROW; while ((!IS_BLANK(CUR)) && (CUR != '<') && (CUR != '&') && (CUR != '>') && - (CUR != '\'') && (CUR != '"')) + (CUR != '\'') && (CUR != '"')) { + buf[len++] = CUR; NEXT; - - ret = xmlStrndup(q, CUR_PTR - q); - - return(ret); + if (len >= HTML_MAX_NAMELEN) { + fprintf(stderr, + "htmlParseHTMLAttribute: reached HTML_MAX_NAMELEN limit\n"); + while ((!IS_BLANK(CUR)) && (CUR != '<') && + (CUR != '&') && (CUR != '>') && + (CUR != '\'') && (CUR != '"')) + NEXT; + break; + } + } + return(xmlStrndup(buf, len)); } /** @@ -1226,21 +1275,30 @@ htmlParseHTMLAttribute(htmlParserCtxtPtr ctxt) { CHAR * htmlParseNmtoken(htmlParserCtxtPtr ctxt) { - const CHAR *q; - CHAR *ret = NULL; - - q = NEXT; + CHAR buf[HTML_MAX_NAMELEN]; + int len = 0; + GROW; while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || (CUR == '.') || (CUR == '-') || (CUR == '_') || (CUR == ':') || (IS_COMBINING(CUR)) || - (IS_EXTENDER(CUR))) + (IS_EXTENDER(CUR))) { + buf[len++] = CUR; NEXT; - - ret = xmlStrndup(q, CUR_PTR - q); - - return(ret); + if (len >= HTML_MAX_NAMELEN) { + fprintf(stderr, + "htmlParseNmtoken: reached HTML_MAX_NAMELEN limit\n"); + while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || + (CUR == '.') || (CUR == '-') || + (CUR == '_') || (CUR == ':') || + (IS_COMBINING(CUR)) || + (IS_EXTENDER(CUR))) + NEXT; + break; + } + } + return(xmlStrndup(buf, len)); } /** @@ -1269,6 +1327,7 @@ htmlParseEntityRef(htmlParserCtxtPtr ctxt, CHAR **str) { ctxt->sax->error(ctxt->userData, "htmlParseEntityRef: no name\n"); ctxt->wellFormed = 0; } else { + GROW; if (CUR == ';') { NEXT; *str = name; @@ -1565,36 +1624,10 @@ htmlParseExternalID(htmlParserCtxtPtr ctxt, CHAR **publicID, int strict) { "htmlParseExternalID: PUBLIC, no Public Identifier\n"); ctxt->wellFormed = 0; } - if (strict) { - /* - * We don't handle [83] so "S SystemLiteral" is required. - */ - if (!IS_BLANK(CUR)) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "Space required after the Public Identifier\n"); - ctxt->wellFormed = 0; - } - } else { - /* - * We handle [83] so we return immediately, if - * "S SystemLiteral" is not detected. From a purely parsing - * point of view that's a nice mess. - */ - const CHAR *ptr = CUR_PTR; - if (!IS_BLANK(*ptr)) return(NULL); - - while (IS_BLANK(*ptr)) ptr++; - if ((*ptr != '\'') || (*ptr != '"')) return(NULL); - } SKIP_BLANKS; - URI = htmlParseSystemLiteral(ctxt); - if (URI == NULL) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, - "htmlParseExternalID: PUBLIC, no URI\n"); - ctxt->wellFormed = 0; - } + if ((CUR == '"') || (CUR == '\'')) { + URI = htmlParseSystemLiteral(ctxt); + } } return(URI); } @@ -1766,7 +1799,7 @@ htmlParseDocTypeDecl(htmlParserCtxtPtr ctxt) { /* * Check for SystemID and ExternalID */ - URI = htmlParseExternalID(ctxt, &ExternalID, 1); + URI = htmlParseExternalID(ctxt, &ExternalID, 0); SKIP_BLANKS; /* @@ -2027,6 +2060,7 @@ htmlParseEndTag(htmlParserCtxtPtr ctxt, const CHAR *tagname) { ctxt->sax->error(ctxt->userData, "htmlParseEndTag: unexpected close for tag %s\n", tagname); + free(name); ctxt->wellFormed = 0; return; } @@ -2168,6 +2202,7 @@ htmlParseContent(htmlParserCtxtPtr ctxt, const CHAR *name) { ctxt->wellFormed = 0; break; } + GROW; } /* @@ -2232,8 +2267,9 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { return; } - if (CUR == '>') NEXT; - else { + if (CUR == '>') { + NEXT; + } else { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Couldn't find end of Start Tag\n%.30s\n", openTag); @@ -2305,6 +2341,7 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) { htmlDefaultSAXHandlerInit(); ctxt->html = 1; + GROW; /* * SAX: beginning of the document processing TODO: update for HTML. */ @@ -2490,6 +2527,7 @@ htmlCreateDocParserCtxt(CHAR *cur, const char *encoding) { input->base = cur; input->cur = cur; input->free = NULL; + input->buf = NULL; inputPush(ctxt, input); return(ctxt); @@ -2572,114 +2610,12 @@ htmlParserCtxtPtr htmlCreateFileParserCtxt(const char *filename, const char *encoding) { htmlParserCtxtPtr ctxt; -#ifdef HAVE_ZLIB_H - gzFile input; -#else - int input; -#endif - int res; - int len; - int cnt; - struct stat buf; - char *buffer, *nbuf; htmlParserInputPtr inputStream; + xmlParserInputBufferPtr buf; /* htmlCharEncoding enc; */ -#define MINLEN 40000 - - if (strcmp(filename,"-") == 0) { -#ifdef HAVE_ZLIB_H - input = gzdopen (fileno(stdin), "r"); - if (input == NULL) { - fprintf (stderr, "Cannot read from stdin\n"); - perror ("gzdopen failed"); - return(NULL); - } -#else -#ifdef WIN32 - input = -1; -#else - input = fileno(stdin); -#endif - if (input < 0) { - fprintf (stderr, "Cannot read from stdin\n"); - perror ("open failed"); - return(NULL); - } -#endif - len = MINLEN; - } else { -#ifdef HAVE_ZLIB_H - input = gzopen (filename, "r"); - if (input == NULL) { - fprintf (stderr, "Cannot read file %s :\n", filename); - perror ("gzopen failed"); - return(NULL); - } -#else -#ifdef WIN32 - input = _open (filename, O_RDONLY | _O_BINARY); -#else - input = open (filename, O_RDONLY); -#endif - if (input < 0) { - fprintf (stderr, "Cannot read file %s :\n", filename); - perror ("open failed"); - return(NULL); - } -#endif - res = stat(filename, &buf); - if (res < 0) - return(NULL); - len = buf.st_size; - if (len < MINLEN) - len = MINLEN; - } - buffer = (char *)malloc((len+1)*sizeof(char)); - if (buffer == NULL) { - fprintf (stderr, "Cannot malloc\n"); - perror ("malloc failed"); - return(NULL); - } - - cnt = 0; - while(1) { - if (cnt == len) { - len *= 2; - nbuf = (char *)realloc(buffer,(len+1)*sizeof(char)); - if (nbuf == NULL) { - fprintf(stderr,"Cannot realloc\n"); - free(buffer); - perror ("realloc failed"); - return(NULL); - } - buffer = nbuf; - } -#ifdef HAVE_ZLIB_H - res = gzread(input, &buffer[cnt], len-cnt); -#else - res = read(input, &buffer[cnt], len-cnt); -#endif - if (res < 0) { - fprintf (stderr, "Cannot read file %s :\n", filename); -#ifdef HAVE_ZLIB_H - perror ("gzread failed"); -#else - perror ("read failed"); -#endif - return(NULL); - } - if (res == 0) - break; - cnt +=res; - } - buffer[cnt] = '\0'; - -#ifdef HAVE_ZLIB_H - gzclose(input); -#else - close(input); -#endif + buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE); + if (buf == NULL) return(NULL); ctxt = (htmlParserCtxtPtr) malloc(sizeof(htmlParserCtxt)); if (ctxt == NULL) { @@ -2697,18 +2633,11 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding) inputStream->filename = strdup(filename); inputStream->line = 1; inputStream->col = 1; + inputStream->buf = buf; - /* - * plug some encoding conversion routines here. !!! - if (encoding != NULL) { - enc = htmlDetectCharEncoding(buffer); - htmlSwitchEncoding(ctxt, enc); - } - */ - - inputStream->base = buffer; - inputStream->cur = buffer; - inputStream->free = (xmlParserInputDeallocate) free; + inputStream->base = inputStream->buf->buffer->content; + inputStream->cur = inputStream->buf->buffer->content; + inputStream->free = NULL; inputPush(ctxt, inputStream); return(ctxt); diff --git a/Makefile.am b/Makefile.am index 008a294f..08247e22 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,6 +25,7 @@ libxml_la_SOURCES = \ debugXML.c \ tree.c \ xpath.c \ + xmlIO.c \ valid.c xmlincdir = $(includedir)/gnome-xml diff --git a/SAXresult/dav1 b/SAXresult/dav1 index a3ec1b49..9c1988ff 100644 --- a/SAXresult/dav1 +++ b/SAXresult/dav1 @@ -2,99 +2,80 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:multistatus, xmlns:D='http://www.ietf.org/standards/dav/', xmlns:R='http://www.foo.bar/boxschema') SAX.characters( - - - , 3) + , 3) SAX.startElement(D:response) SAX.characters( - - , 5) + , 5) SAX.startElement(D:prop) SAX.characters( - - Box type A, 9) + , 9) SAX.startElement(R:BoxType) -SAX.characters(Box type A - <, 10) +SAX.characters(Box type A, 10) SAX.endElement(R:BoxType) SAX.characters( - - - J.J. Dinglehe, 9) + , 9) SAX.startElement(R:Name) -SAX.characters(J.J. Dingleheimerschmidt - - H, 5) + , 5) SAX.endElement(D:prop) SAX.characters( - HTTP/1.1 200 OK, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP/1.1 200 OK - <, 15) +SAX.characters(HTTP/1.1 200 OK, 15) SAX.endElement(D:status) SAX.characters( - - - - , 3) + , 3) SAX.startElement(D:response) SAX.characters( - - - - - H, 5) + , 5) SAX.endElement(D:prop) SAX.characters( - HTTP/1.1 403 Fo, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP/1.1 403 Forbidden T, 5) + , 5) SAX.startElement(D:responsedescription) SAX.characters( The user does not have access, 64) SAX.endElement(D:responsedescription) SAX.characters( - - The, 3) + , 3) SAX.startElement(D:responsedescription) SAX.characters( There has been an access viol, 44) SAX.endElement(D:responsedescription) SAX.characters( - , 1) SAX.endElement(D:multistatus) SAX.endDocument() diff --git a/SAXresult/dav10 b/SAXresult/dav10 index e8a0e1e9..aa982514 100644 --- a/SAXresult/dav10 +++ b/SAXresult/dav10 @@ -2,12 +2,11 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:owner, xmlns:D='http://www.ietf.org/standards/dav/') SAX.characters( - http://www.ics.uci., 3) + , 3) SAX.startElement(D:href) SAX.characters(http://www.ics.uci.edu/~ejw/co, 40) SAX.endElement(D:href) SAX.characters( - , 1) SAX.endElement(D:owner) SAX.endDocument() diff --git a/SAXresult/dav11 b/SAXresult/dav11 index aa69d1f6..43815e53 100644 --- a/SAXresult/dav11 +++ b/SAXresult/dav11 @@ -2,76 +2,61 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:prop, xmlns:D='http://www.ietf.org/standards/dav/') SAX.characters( - - - write - exclusive<, 7) + , 7) SAX.startElement(D:lockscope) -SAX.characters(exclusive - , 9) +SAX.characters(exclusive, 9) SAX.endElement(D:lockscope) SAX.characters( - - - - http://www, 9) + , 9) SAX.startElement(D:href) SAX.characters( http://www.ics.uci.edu/~ejw, 46) SAX.endElement(D:href) SAX.characters( - - Second-60480, 7) + , 7) SAX.startElement(D:timeout) -SAX.characters(Second-604800 - , 13) +SAX.characters(Second-604800, 13) SAX.endElement(D:timeout) SAX.characters( - - <, 7) + , 7) SAX.startElement(D:locktoken) SAX.characters( - - opaquelo, 9) + , 9) SAX.startElement(D:href) SAX.characters( opaquelocktoken:xyz122393, 59) SAX.endElement(D:href) SAX.characters( - - - - , 1) SAX.endElement(D:prop) SAX.endDocument() diff --git a/SAXresult/dav13 b/SAXresult/dav13 index e7f104d9..16edfd1c 100644 --- a/SAXresult/dav13 +++ b/SAXresult/dav13 @@ -2,54 +2,45 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:multistatus, xmlns:D='http://www.ietf.org/standards/dav/') SAX.characters( - - - , 3) + , 3) SAX.startElement(D:response) SAX.characters( - - http://webda, 5) + , 5) SAX.startElement(D:href) SAX.characters( http://webdav.sb.aol.com/, 66) SAX.endElement(D:href) SAX.characters( - - http://webda, 5) + , 5) SAX.startElement(D:href) SAX.characters( http://webdav.sb.aol.com/, 54) SAX.endElement(D:href) SAX.characters( - HTTP/1.1 202 Ac, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP/1.1 202 Accepted - - ht, 3) + , 3) SAX.startElement(D:response) SAX.characters( - http://foo.bar/bl, 5) + , 5) SAX.startElement(D:href) -SAX.characters(http://foo.bar/blah - , 19) +SAX.characters(http://foo.bar/blah, 19) SAX.endElement(D:href) SAX.characters( - HTTP/1.1 403 Fo, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP/1.1 403 Forbidden - , 1) SAX.endElement(D:multistatus) SAX.endDocument() diff --git a/SAXresult/dav15 b/SAXresult/dav15 index b3c545f1..634ec7db 100644 --- a/SAXresult/dav15 +++ b/SAXresult/dav15 @@ -2,92 +2,75 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:prop, xmlns:D='http://www.ietf.org/standards/dav/', xmlns:F='http://www.foocorp.com/Project/') SAX.characters( - - - , 3) + , 3) SAX.startElement(D:Source) SAX.characters( - - Source - http://foo.bar/p, 7) + , 7) SAX.startElement(D:src) -SAX.characters(http://foo.bar/program, 22) +SAX.characters(http://foo.bar/program, 22) SAX.endElement(D:src) SAX.characters( - http://foo.bar/s, 7) + , 7) SAX.startElement(D:dst) -SAX.characters(http://foo.bar/src/main.c - - , 5) + , 5) SAX.endElement(D:link) SAX.characters( - - Library - http://foo.bar/p, 7) + , 7) SAX.startElement(D:src) -SAX.characters(http://foo.bar/program, 22) +SAX.characters(http://foo.bar/program, 22) SAX.endElement(D:src) SAX.characters( - http://foo.bar/s, 7) + , 7) SAX.startElement(D:dst) -SAX.characters(http://foo.bar/src/main.lib - - , 5) + , 5) SAX.endElement(D:link) SAX.characters( - - Makefile - <, 8) +SAX.characters(Makefile, 8) SAX.endElement(F:projfiles) SAX.characters( - http://foo.bar/p, 7) + , 7) SAX.startElement(D:src) -SAX.characters(http://foo.bar/program, 22) +SAX.characters(http://foo.bar/program, 22) SAX.endElement(D:src) SAX.characters( - http://foo.bar/s, 7) + , 7) SAX.startElement(D:dst) -SAX.characters(http://foo.bar/src/makefile - -<, 5) + , 5) SAX.endElement(D:link) SAX.characters( - - -, 3) + , 3) SAX.endElement(D:Source) SAX.characters( - , 1) SAX.endElement(D:prop) SAX.endDocument() diff --git a/SAXresult/dav16 b/SAXresult/dav16 index 5f4f4f96..a21252b3 100644 --- a/SAXresult/dav16 +++ b/SAXresult/dav16 @@ -2,21 +2,16 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:propfind, xmlns:D='http://www.ietf.org/standards/dav/') SAX.characters( - - - - -, 3) + , 3) SAX.endElement(D:prop) SAX.characters( - , 1) SAX.endElement(D:propfind) SAX.endDocument() diff --git a/SAXresult/dav17 b/SAXresult/dav17 index 6cbf8823..83f5bcee 100644 --- a/SAXresult/dav17 +++ b/SAXresult/dav17 @@ -2,98 +2,77 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:multistatus, xmlns:D='http://www.ietf.org/standards/dav/') SAX.characters( - - - , 3) + , 3) SAX.startElement(D:response) SAX.characters( - - - , 7) + , 7) SAX.startElement(D:lockdiscovery) SAX.characters( - - , 9) + , 9) SAX.startElement(D:activelock) SAX.characters( - write - <, 5) +SAX.characters(write, 5) SAX.endElement(D:locktype) SAX.characters( - exclus, 11) + , 11) SAX.startElement(D:lockscope) -SAX.characters(exclusive - , 9) +SAX.characters(exclusive, 9) SAX.endElement(D:lockscope) SAX.characters( - - , 11) + , 11) SAX.startElement(D:addlocks) SAX.characters( - http://fo, 13) + , 13) SAX.startElement(D:href) -SAX.characters(http://foo.com/doc/ - , 19) +SAX.characters(http://foo.com/doc/, 19) SAX.endElement(D:href) SAX.characters( - - , 11) + , 11) SAX.endElement(D:addlocks) SAX.characters( - Jane Smith, 11) + , 11) SAX.startElement(D:owner) -SAX.characters(Jane Smith - , 10) +SAX.characters(Jane Smith, 10) SAX.endElement(D:owner) SAX.characters( - Infinite, 11) + , 11) SAX.startElement(D:timeout) -SAX.characters(Infinite - , 8) +SAX.characters(Infinite, 8) SAX.endElement(D:timeout) SAX.characters( - - , 11) + , 11) SAX.startElement(D:locktoken) SAX.characters( - iamuri:un, 13) + , 13) SAX.startElement(D:href) -SAX.characters(iamuri:unique!!!!! - , 18) +SAX.characters(iamuri:unique!!!!!, 18) SAX.endElement(D:href) SAX.characters( - - , 11) + , 11) SAX.endElement(D:locktoken) SAX.characters( - - , 9) + , 9) SAX.endElement(D:activelock) SAX.characters( - - , 7) + , 7) SAX.endElement(D:lockdiscovery) SAX.characters( - - H, 5) + , 5) SAX.endElement(D:prop) SAX.characters( - HTTP/1.1 200 OK, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP/1.1 200 OK - <, 15) +SAX.characters(HTTP/1.1 200 OK, 15) SAX.endElement(D:status) SAX.characters( - - , 1) SAX.endElement(D:multistatus) SAX.endDocument() diff --git a/SAXresult/dav18 b/SAXresult/dav18 index 906cd4b7..39f40e6d 100644 --- a/SAXresult/dav18 +++ b/SAXresult/dav18 @@ -2,21 +2,16 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:propfind, xmlns:D='http://www.ietf.org/standards/dav/') SAX.characters( - - - - -, 3) + , 3) SAX.endElement(D:prop) SAX.characters( - , 1) SAX.endElement(D:propfind) SAX.endDocument() diff --git a/SAXresult/dav19 b/SAXresult/dav19 index d19bb10b..c65e03de 100644 --- a/SAXresult/dav19 +++ b/SAXresult/dav19 @@ -2,78 +2,61 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:multistatus, xmlns:D='http://www.ietf.org/standards/dav/') SAX.characters( - - - , 3) + , 3) SAX.startElement(D:response) SAX.characters( - - - , 7) + , 7) SAX.startElement(D:supportedlock) SAX.characters( - - , 9) + , 9) SAX.startElement(D:LockEntry) SAX.characters( - Write - <, 5) +SAX.characters(Write, 5) SAX.endElement(D:locktype) SAX.characters( - Exclus, 11) + , 11) SAX.startElement(D:lockscope) -SAX.characters(Exclusive - , 9) +SAX.characters(Exclusive, 9) SAX.endElement(D:lockscope) SAX.characters( - - , 9) + , 9) SAX.endElement(D:LockEntry) SAX.characters( - - , 9) + , 9) SAX.startElement(D:LockEntry) SAX.characters( - Write - <, 5) +SAX.characters(Write, 5) SAX.endElement(D:locktype) SAX.characters( - Shared, 11) + , 11) SAX.startElement(D:lockscope) -SAX.characters(Shared - <, 6) +SAX.characters(Shared, 6) SAX.endElement(D:lockscope) SAX.characters( - - , 9) + , 9) SAX.endElement(D:LockEntry) SAX.characters( - - , 7) + , 7) SAX.endElement(D:supportedlock) SAX.characters( - - H, 5) + , 5) SAX.endElement(D:prop) SAX.characters( - HTTP/1.1 200 OK, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP/1.1 200 OK - <, 15) +SAX.characters(HTTP/1.1 200 OK, 15) SAX.endElement(D:status) SAX.characters( - - , 1) SAX.endElement(D:multistatus) SAX.endDocument() diff --git a/SAXresult/dav2 b/SAXresult/dav2 index 28a069bd..95bc06a1 100644 --- a/SAXresult/dav2 +++ b/SAXresult/dav2 @@ -2,103 +2,83 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(S:multistatus, xmlns:S='http://www.ietf.org/standards/dav/', xmlns:R='http://www.foo.bar/boxschema/') SAX.characters( - - ht, 3) + , 3) SAX.startElement(S:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(S:href) -SAX.characters(http://www.foo.bar/container/<, 29) +SAX.characters(http://www.foo.bar/container/, 29) SAX.endElement(S:href) SAX.characters( - - , 5) + , 5) SAX.startElement(S:prop) SAX.characters( - - Box type A, 9) + , 9) SAX.startElement(R:BoxType) -SAX.characters(Box type A - <, 10) +SAX.characters(Box type A, 10) SAX.endElement(R:BoxType) SAX.characters( - - - Hadrian - - - H, 5) + , 5) SAX.endElement(S:prop) SAX.characters( - HTTP 1.1 200 OK, 5) + , 5) SAX.startElement(S:status) -SAX.characters(HTTP 1.1 200 OK - <, 15) +SAX.characters(HTTP 1.1 200 OK, 15) SAX.endElement(S:status) SAX.characters( - - - ht, 3) + , 3) SAX.startElement(S:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(S:href) SAX.characters(http://www.foo.bar/container/i, 39) SAX.endElement(S:href) SAX.characters( - - , 5) + , 5) SAX.startElement(S:prop) SAX.characters( - - Box type B, 9) + , 9) SAX.startElement(R:BoxType) -SAX.characters(Box type B - <, 10) +SAX.characters(Box type B, 10) SAX.endElement(R:BoxType) SAX.characters( - - - H, 5) + , 5) SAX.endElement(S:prop) SAX.characters( - HTTP 1.1 200 OK, 5) + , 5) SAX.startElement(S:status) -SAX.characters(HTTP 1.1 200 OK - <, 15) +SAX.characters(HTTP 1.1 200 OK, 15) SAX.endElement(S:status) SAX.characters( - - , 1) SAX.endElement(S:multistatus) SAX.endDocument() diff --git a/SAXresult/dav3 b/SAXresult/dav3 index a82bad34..e9eabd88 100644 --- a/SAXresult/dav3 +++ b/SAXresult/dav3 @@ -2,76 +2,62 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:multistatus, xmlns:D='http://www.ietf.org/standards/dav/', xmlns:R='http://www.foo.bar/boxschema/') SAX.characters( - - ht, 3) + , 3) SAX.startElement(D:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(D:href) -SAX.characters(http://www.foo.bar/container/<, 29) +SAX.characters(http://www.foo.bar/container/, 29) SAX.endElement(D:href) SAX.characters( - - - - - H, 5) + , 5) SAX.endElement(D:prop) SAX.characters( - HTTP 1.1 200 OK, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP 1.1 200 OK - <, 15) +SAX.characters(HTTP 1.1 200 OK, 15) SAX.endElement(D:status) SAX.characters( - - - ht, 3) + , 3) SAX.startElement(D:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(D:href) SAX.characters(http://www.foo.bar/container/i, 39) SAX.endElement(D:href) SAX.characters( - - - - H, 5) + , 5) SAX.endElement(D:prop) SAX.characters( - HTTP 1.1 200 OK, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP 1.1 200 OK - <, 15) +SAX.characters(HTTP 1.1 200 OK, 15) SAX.endElement(D:status) SAX.characters( - - , 1) SAX.endElement(D:multistatus) SAX.endDocument() diff --git a/SAXresult/dav4 b/SAXresult/dav4 index 50a115db..8268026c 100644 --- a/SAXresult/dav4 +++ b/SAXresult/dav4 @@ -2,69 +2,50 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:propertyupdate, xmlns:D='http://www.ietf.org/standards/dav/', xmlns:Z='http://www.w3.com/standards/z39.50/') SAX.characters( - - - , 3) + , 3) SAX.startElement(D:set) SAX.characters( - - - Jim Whitehe, 9) + , 9) SAX.startElement(Z:Author) -SAX.characters(Jim Whitehead - , 13) +SAX.characters(Jim Whitehead, 13) SAX.endElement(Z:Author) SAX.characters( - Roy Fieldin, 9) + , 9) SAX.startElement(Z:Author) -SAX.characters(Roy Fielding - , 12) +SAX.characters(Roy Fielding, 12) SAX.endElement(Z:Author) SAX.characters( - - - - - - <, 3) + , 3) SAX.endElement(D:set) SAX.characters( - - - , 3) + , 3) SAX.startElement(D:remove) SAX.characters( - - - , 7) + , 7) SAX.startElement(Z:Copyright-Owner) SAX.endElement(Z:Copyright-Owner) SAX.characters( - - -<, 5) + , 5) SAX.endElement(D:prop) SAX.characters( - - , 1) SAX.endElement(D:propertyupdate) SAX.endDocument() diff --git a/SAXresult/dav5 b/SAXresult/dav5 index 84256e9c..53967f81 100644 --- a/SAXresult/dav5 +++ b/SAXresult/dav5 @@ -2,66 +2,53 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:multistatus, xmlns:D='http://www.ietf.org/standards/dav/', xmlns:Z='http://www.w3.com/standards/z39.50/') SAX.characters( - - - , 3) + , 3) SAX.startElement(D:response) SAX.characters( - - - - H, 5) + , 5) SAX.endElement(D:prop) SAX.characters( - HTTP/1.1 420 Me, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP/1.1 420 Method Failure - - - , 3) + , 3) SAX.startElement(D:response) SAX.characters( - - - , 7) + , 7) SAX.startElement(Z:Copyright-Owner) SAX.endElement(Z:Copyright-Owner) SAX.characters( - - H, 5) + , 5) SAX.endElement(D:prop) SAX.characters( - HTTP/1.1 409 Co, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP/1.1 409 Conflict - Cop, 3) + , 3) SAX.startElement(D:responsedescription) SAX.characters( Copyright Owner can not be de, 47) SAX.endElement(D:responsedescription) SAX.characters( - , 1) SAX.endElement(D:multistatus) SAX.endDocument() diff --git a/SAXresult/dav6 b/SAXresult/dav6 index 7e5951be..a6a5b2d8 100644 --- a/SAXresult/dav6 +++ b/SAXresult/dav6 @@ -2,82 +2,65 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(D:multistatus, xmlns:D='http://www.ietf.org/standards/dav/') SAX.characters( - - ht, 3) + , 3) SAX.startElement(D:response) SAX.characters( - http://www.micros, 5) + , 5) SAX.startElement(D:href) SAX.characters(http://www.microsoft.com/user/, 55) SAX.endElement(D:href) SAX.characters( - - , 7) SAX.startElement(D:resourcetype) SAX.characters( - - , 9) + , 9) SAX.startElement(D:collection) SAX.endElement(D:collection) SAX.characters( - - <, 7) + , 7) SAX.endElement(D:resourcetype) SAX.characters( - - H, 5) + , 5) SAX.endElement(D:prop) SAX.characters( - HTTP 1.1 200 OK, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP 1.1 200 OK - <, 15) +SAX.characters(HTTP 1.1 200 OK, 15) SAX.endElement(D:status) SAX.characters( - - - - , 3) + , 3) SAX.startElement(D:response) SAX.characters( - - http://www, 5) + , 5) SAX.startElement(D:href) SAX.characters( http://www.microsoft.co, 66) SAX.endElement(D:href) SAX.characters( - - - <, 7) + , 7) SAX.startElement(D:resourcetype) SAX.endElement(D:resourcetype) SAX.characters( - - H, 5) + , 5) SAX.endElement(D:prop) SAX.characters( - HTTP 1.1 200 OK, 5) + , 5) SAX.startElement(D:status) -SAX.characters(HTTP 1.1 200 OK - <, 15) +SAX.characters(HTTP 1.1 200 OK, 15) SAX.endElement(D:status) SAX.characters( - - , 1) SAX.endElement(D:multistatus) SAX.endDocument() diff --git a/SAXresult/dav7 b/SAXresult/dav7 index c251d93e..133a9c1e 100644 --- a/SAXresult/dav7 +++ b/SAXresult/dav7 @@ -2,67 +2,59 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(d:multistatus, xmlns:d='http://www.ietf.org/standards/dav/') SAX.characters( - - ht, 3) + , 3) SAX.startElement(d:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/container/r, 38) SAX.endElement(d:href) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/container/r, 38) SAX.endElement(d:href) SAX.characters( - HTTP/1.1 200 OK, 5) + , 5) SAX.startElement(d:status) -SAX.characters(HTTP/1.1 200 OK - <, 15) +SAX.characters(HTTP/1.1 200 OK, 15) SAX.endElement(d:status) SAX.characters( - - - ht, 3) + , 3) SAX.startElement(d:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) -SAX.characters(http://www.foo.bar/container/<, 29) +SAX.characters(http://www.foo.bar/container/, 29) SAX.endElement(d:href) SAX.characters( - HTTP/1.1 420 Me, 5) + , 5) SAX.startElement(d:status) -SAX.characters(HTTP/1.1 420 Method Failure - - ht, 3) + , 3) SAX.startElement(d:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/container/r, 38) SAX.endElement(d:href) SAX.characters( - HTTP/1.1 412 Pr, 5) + , 5) SAX.startElement(d:status) SAX.characters(HTTP/1.1 412 Precondition Fail, 32) SAX.endElement(d:status) SAX.characters( - - , 1) SAX.endElement(d:multistatus) SAX.endDocument() diff --git a/SAXresult/dav8 b/SAXresult/dav8 index 225c8d62..8a810eff 100644 --- a/SAXresult/dav8 +++ b/SAXresult/dav8 @@ -2,58 +2,53 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(d:multistatus, xmlns:d='http://www.ietf.org/standards/dav/') SAX.characters( - - ht, 3) + , 3) SAX.startElement(d:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/othercontai, 43) SAX.endElement(d:href) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/othercontai, 43) SAX.endElement(d:href) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/othercontai, 34) SAX.endElement(d:href) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/othercontai, 39) SAX.endElement(d:href) SAX.characters( - HTTP/1.1 201 Cr, 5) + , 5) SAX.startElement(d:status) -SAX.characters(HTTP/1.1 201 Created - - ht, 3) + , 3) SAX.startElement(d:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/othercontai, 37) SAX.endElement(d:href) SAX.characters( - HTTP/1.1 412 Pr, 5) + , 5) SAX.startElement(d:status) SAX.characters(HTTP/1.1 412 Precondition Fail, 32) SAX.endElement(d:status) SAX.characters( - - , 1) SAX.endElement(d:multistatus) SAX.endDocument() diff --git a/SAXresult/dav9 b/SAXresult/dav9 index 65421a8c..4116bad1 100644 --- a/SAXresult/dav9 +++ b/SAXresult/dav9 @@ -2,76 +2,69 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(d:multistatus, xmlns:d='http://www.ietf.org/standards/dav/') SAX.characters( - - ht, 3) + , 3) SAX.startElement(d:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/container/r, 38) SAX.endElement(d:href) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/container/r, 38) SAX.endElement(d:href) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) -SAX.characters(http://www.foo.bar/container/<, 29) +SAX.characters(http://www.foo.bar/container/, 29) SAX.endElement(d:href) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/container/C, 34) SAX.endElement(d:href) SAX.characters( - HTTP/1.1 201 Cr, 5) + , 5) SAX.startElement(d:status) -SAX.characters(HTTP/1.1 201 Created - - ht, 3) + , 3) SAX.startElement(d:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/container/C, 31) SAX.endElement(d:href) SAX.characters( - HTTP/1.1 420 Me, 5) + , 5) SAX.startElement(d:status) -SAX.characters(HTTP/1.1 420 Method Failure - - ht, 3) + , 3) SAX.startElement(d:response) SAX.characters( - http://www.foo.ba, 5) + , 5) SAX.startElement(d:href) SAX.characters(http://www.foo.bar/othercontai, 36) SAX.endElement(d:href) SAX.characters( - HTTP/1.1 409 Co, 5) + , 5) SAX.startElement(d:status) -SAX.characters(HTTP/1.1 409 Conflict - , 1) SAX.endElement(d:multistatus) SAX.endDocument() diff --git a/SAXresult/dia1 b/SAXresult/dia1 index 3370c489..6f65d63f 100644 --- a/SAXresult/dia1 +++ b/SAXresult/dia1 @@ -2,364 +2,322 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(dia:diagram, xmlns:dia='http://www.lysator.liu.se/~alla/dia/') SAX.characters( - - - - , 7) SAX.endElement(dia:attribute) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - , 9) + , 9) SAX.startElement(dia:real, val='0.1') SAX.endElement(dia:real) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.startElement(dia:enum, val='0') SAX.endElement(dia:enum) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.startElement(dia:enum, val='0') SAX.endElement(dia:enum) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.startElement(dia:enum, val='0') SAX.endElement(dia:enum) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 7) + , 7) SAX.startElement(dia:connections) SAX.characters( - - , 7) + , 7) SAX.endElement(dia:connections) SAX.characters( - - - , 11) + , 11) SAX.endElement(dia:attribute) SAX.characters( - - , 11) + , 11) SAX.endElement(dia:attribute) SAX.characters( - - , 11) + , 11) SAX.endElement(dia:attribute) SAX.characters( - - , 11) + , 11) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.endElement(dia:composite) SAX.characters( - - - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.startElement(dia:real, val='2') SAX.endElement(dia:real) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - , 9) + , 9) SAX.startElement(dia:real, val='0.1') SAX.endElement(dia:real) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.startElement(dia:enum, val='0') SAX.endElement(dia:enum) SAX.characters( - - - -, 3) + , 3) SAX.endElement(dia:layer) SAX.characters( - , 1) SAX.endElement(dia:diagram) SAX.endDocument() diff --git a/SAXresult/dia2 b/SAXresult/dia2 index 3370c489..6f65d63f 100644 --- a/SAXresult/dia2 +++ b/SAXresult/dia2 @@ -2,364 +2,322 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(dia:diagram, xmlns:dia='http://www.lysator.liu.se/~alla/dia/') SAX.characters( - - - - , 7) SAX.endElement(dia:attribute) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - , 9) + , 9) SAX.startElement(dia:real, val='0.1') SAX.endElement(dia:real) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.startElement(dia:enum, val='0') SAX.endElement(dia:enum) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.startElement(dia:enum, val='0') SAX.endElement(dia:enum) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.startElement(dia:enum, val='0') SAX.endElement(dia:enum) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 7) + , 7) SAX.startElement(dia:connections) SAX.characters( - - , 7) + , 7) SAX.endElement(dia:connections) SAX.characters( - - - , 11) + , 11) SAX.endElement(dia:attribute) SAX.characters( - - , 11) + , 11) SAX.endElement(dia:attribute) SAX.characters( - - , 11) + , 11) SAX.endElement(dia:attribute) SAX.characters( - - , 11) + , 11) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.endElement(dia:composite) SAX.characters( - - - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.startElement(dia:real, val='2') SAX.endElement(dia:real) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - , 9) + , 9) SAX.startElement(dia:real, val='0.1') SAX.endElement(dia:real) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - , 7) SAX.endElement(dia:attribute) SAX.characters( - - , 9) + , 9) SAX.startElement(dia:enum, val='0') SAX.endElement(dia:enum) SAX.characters( - - - -, 3) + , 3) SAX.endElement(dia:layer) SAX.characters( - , 1) SAX.endElement(dia:diagram) SAX.endDocument() diff --git a/SAXresult/dtd1 b/SAXresult/dtd1 index db7183fd..5f8cf03e 100644 --- a/SAXresult/dtd1 +++ b/SAXresult/dtd1 @@ -4,7 +4,6 @@ SAX.internalSubset(MEMO, -//SGMLSOURCE//DTD MEMO//EN, http://www.sgmlsource.com/ SAX.resolveEntity(-//SGMLSOURCE//DTD MEMO//EN, http://www.sgmlsource.com/dtds/memo.dtd) SAX.startElement(MEMO) SAX.characters( - , 1) SAX.endElement(MEMO) SAX.endDocument() diff --git a/SAXresult/dtd10 b/SAXresult/dtd10 index c9673563..bcd3bb80 100644 --- a/SAXresult/dtd10 +++ b/SAXresult/dtd10 @@ -8,14 +8,13 @@ SAX.elementDecl(c, 3, ...) SAX.elementDecl(d, 3, ...) SAX.startElement(doc) SAX.startElement(b) -SAX.characters(This is a valid , 4) +SAX.characters(This, 4) SAX.endElement(b) SAX.startElement(c) -SAX.characters( is a valid document -, 15) +SAX.characters( valid document, 15) SAX.endElement(d) SAX.endElement(doc) SAX.endDocument() diff --git a/SAXresult/dtd2 b/SAXresult/dtd2 index 22039349..f0302d3b 100644 --- a/SAXresult/dtd2 +++ b/SAXresult/dtd2 @@ -3,6 +3,6 @@ SAX.startDocument() SAX.internalSubset(doc, (null), (null)) SAX.elementDecl(doc, 3, ...) SAX.startElement(doc) -SAX.characters(This is a valid document ! is a valid doc, 4) +SAX.characters(This, 4) SAX.endElement(a) -SAX.characters( is a valid document document -, 5) +SAX.characters(valid, 5) SAX.endElement(b) -SAX.characters( document -, 9) +SAX.characters( document, 9) SAX.endElement(doc) SAX.endDocument() diff --git a/SAXresult/dtd6 b/SAXresult/dtd6 index 8a34085b..c795fcfd 100644 --- a/SAXresult/dtd6 +++ b/SAXresult/dtd6 @@ -6,14 +6,13 @@ SAX.elementDecl(a, 3, ...) SAX.elementDecl(b, 3, ...) SAX.startElement(doc) SAX.startElement(a) -SAX.characters(This is a valid , 4) +SAX.characters(This, 4) SAX.endElement(a) SAX.startElement(b) -SAX.characters( is a valid document -, 9) +SAX.characters( document, 9) SAX.endElement(a) SAX.endElement(doc) SAX.endDocument() diff --git a/SAXresult/dtd7 b/SAXresult/dtd7 index 210258a2..86090952 100644 --- a/SAXresult/dtd7 +++ b/SAXresult/dtd7 @@ -6,10 +6,10 @@ SAX.elementDecl(a, 3, ...) SAX.elementDecl(b, 3, ...) SAX.startElement(doc) SAX.startElement(a) -SAX.characters(This is a valid documen, 4) +SAX.characters(This, 4) SAX.endElement(a) SAX.startElement(b) -SAX.characters( is a valid document, 20) +SAX.characters( is a valid document, 20) SAX.endElement(b) SAX.endElement(doc) SAX.endDocument() diff --git a/SAXresult/dtd8 b/SAXresult/dtd8 index b508a85e..d02548a1 100644 --- a/SAXresult/dtd8 +++ b/SAXresult/dtd8 @@ -8,10 +8,10 @@ SAX.elementDecl(c, 3, ...) SAX.elementDecl(d, 3, ...) SAX.startElement(doc) SAX.startElement(b) -SAX.characters(This is a valid documen, 4) +SAX.characters(This, 4) SAX.endElement(b) SAX.startElement(c) -SAX.characters( is a valid document, 20) +SAX.characters( is a valid document, 20) SAX.endElement(c) SAX.endElement(doc) SAX.endDocument() diff --git a/SAXresult/dtd9 b/SAXresult/dtd9 index c56ec5c4..bb111cc0 100644 --- a/SAXresult/dtd9 +++ b/SAXresult/dtd9 @@ -8,10 +8,10 @@ SAX.elementDecl(c, 3, ...) SAX.elementDecl(d, 3, ...) SAX.startElement(doc) SAX.startElement(b) -SAX.characters(This is a valid documen, 4) +SAX.characters(This, 4) SAX.endElement(b) SAX.startElement(d) -SAX.characters( is a valid document, 20) +SAX.characters( is a valid document, 20) SAX.endElement(d) SAX.endElement(doc) SAX.endDocument() diff --git a/SAXresult/ent1 b/SAXresult/ent1 index 50727c93..b3afa2ac 100644 --- a/SAXresult/ent1 +++ b/SAXresult/ent1 @@ -6,16 +6,13 @@ SAX.entityDecl(xml, 1, (null), (null), Extensible Markup Language) SAX.getEntity(xml) SAX.startElement(EXAMPLE) SAX.characters( - &xml; - -, 5) + , 5) SAX.getEntity(xml) SAX.isStandalone() SAX.hasInternalSubset() SAX.hasExternalSubset() SAX.error: Entity 'xml' not defined SAX.characters( - , 1) SAX.endElement(EXAMPLE) SAX.endDocument() diff --git a/SAXresult/ent2 b/SAXresult/ent2 index a8cfaa12..a5598850 100644 --- a/SAXresult/ent2 +++ b/SAXresult/ent2 @@ -8,8 +8,7 @@ SAX.entityDecl(title, 2, -//MY-TITLE//FR, title.xml, (null)) SAX.entityDecl(image, 3, (null), img.gif, GIF) SAX.startElement(EXAMPLE) SAX.characters( - &title; - This text is abou, 3) + , 3) SAX.getEntity(title) SAX.isStandalone() SAX.hasInternalSubset() @@ -22,12 +21,10 @@ SAX.isStandalone() SAX.hasInternalSubset() SAX.hasExternalSubset() SAX.error: Entity 'xml' not defined -SAX.characters( and this is an embedded - , 1) SAX.endElement(EXAMPLE) SAX.endDocument() diff --git a/SAXresult/ent4 b/SAXresult/ent4 index 0ced33f0..a956632a 100644 --- a/SAXresult/ent4 +++ b/SAXresult/ent4 @@ -6,16 +6,13 @@ SAX.entityDecl(xml, 1, (null), (null), Extensible Markup Language) SAX.getEntity(xml) SAX.startElement(EXAMPLE) SAX.characters( - Test of &amp; behaviour, 11) + Test of , 11) SAX.getEntity(amp) SAX.characters(&, 1) -SAX.characters(amp; behaviour a&b . - - , 4) SAX.endElement(EXAMPLE) SAX.endDocument() diff --git a/SAXresult/ent5 b/SAXresult/ent5 index 6695697d..318447f1 100644 --- a/SAXresult/ent5 +++ b/SAXresult/ent5 @@ -5,11 +5,9 @@ SAX.characters( This is an inverted excla, 42) SAX.characters(¡, 1) SAX.characters( - This is a space - , 2) SAX.endElement(EXAMPLE) SAX.endDocument() diff --git a/SAXresult/p3p b/SAXresult/p3p index 540fe711..5079c254 100644 --- a/SAXresult/p3p +++ b/SAXresult/p3p @@ -2,73 +2,61 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(RDF:RDF, xmlsn:p3p='http//www.w3.org/TR/1998/WD-P3P10-syntax#proposal.DTD', xmlns:RDF='http://www.w3.org/TR/WD-rdf-syntax#') SAX.characters( -, 6) + , 6) SAX.startElement(REF, name='Name.First') SAX.endElement(REF) SAX.characters( - - , 6) + , 6) SAX.startElement(REF, name='Gender') SAX.endElement(REF) SAX.characters( - - - - - - - - - - rpm -, 5) + , 5) SAX.startElement(RPM:Name) -SAX.characters(rpm - 2.5 - 2 - , 1) +SAX.characters(2, 1) SAX.endElement(RPM:Release) SAX.characters( - i386, 5) + , 5) SAX.startElement(RPM:Arch) -SAX.characters(i386 - Li, 4) +SAX.characters(i386, 4) SAX.endElement(RPM:Arch) SAX.characters( - Linux - , 5) + , 5) SAX.startElement(RPM:Os) -SAX.characters(Linux - Manhatt, 5) + , 5) SAX.startElement(RPM:Distribution) -SAX.characters(Manhattan -, 10) +SAX.characters(Manhattan , 10) SAX.endElement(RPM:Distribution) SAX.characters( - Red Hat Softw, 5) + , 5) SAX.startElement(RPM:Vendor) -SAX.characters(Red Hat Software -, 16) +SAX.characters(Red Hat Software, 16) SAX.endElement(RPM:Vendor) SAX.characters( - Red Hat Sof, 5) + , 5) SAX.startElement(RPM:Packager) -SAX.characters(Red Hat Software <bugs@redh, 17) +SAX.characters(Red Hat Software , 17) SAX.getEntity(lt) SAX.characters(<, 1) -SAX.characters(bugs@redhat.com>, 1) SAX.endElement(RPM:Packager) SAX.characters( - Utilities/Syst, 5) + , 5) SAX.startElement(RPM:Group) -SAX.characters(Utilities/System - , 16) +SAX.characters(Utilities/System, 16) SAX.endElement(RPM:Group) SAX.characters( - Red Hat Pack, 5) + , 5) SAX.startElement(RPM:Summary) -SAX.characters(Red Hat Package ManagerRPM is a, 5) + , 5) SAX.startElement(RPM:Description) SAX.characters(RPM is a powerful package mana, 248) SAX.endElement(RPM:Description) SAX.characters( - GPL - * Sun May , 5) + , 5) SAX.startElement(RPM:Changelog) SAX.characters(* Sun May 10 1998 Prospector S, 36) SAX.getEntity(lt) SAX.characters(<, 1) -SAX.characters(bugs@redhat.com> - - transl, 15) +SAX.characters(bugs@redhat.com, 15) SAX.getEntity(gt) SAX.characters(>, 1) SAX.characters( - translations modified for, 42) SAX.endElement(RPM:Changelog) SAX.characters( - rpm-2.5-2.sr, 5) + , 5) SAX.startElement(RPM:Sources) -SAX.characters(rpm-2.5-2.src.rpmftp://ftp, 5) + , 5) SAX.startElement(RPM:SourcesFtp) SAX.characters(ftp://ftp.redhat.com/pub/redha, 48) SAX.endElement(RPM:SourcesFtp) SAX.characters( - Sun May 10, 5) + , 5) SAX.startElement(RPM:BuildDate) -SAX.characters(Sun May 10 14:52:32 1998894826352 - 850599 - porky.redh, 5) + , 5) SAX.startElement(RPM:BuildHost) -SAX.characters(porky.redhat.com - - rpm - - - - - /bin/sh, 9) + , 9) SAX.startElement(RPM:Resource) -SAX.characters(/bin/sh - , 7) +SAX.characters(/bin/sh, 7) SAX.endElement(RPM:Resource) SAX.characters( - ld-linu, 9) + , 9) SAX.startElement(RPM:Resource) -SAX.characters(ld-linux.so.2 - , 13) +SAX.characters(ld-linux.so.2, 13) SAX.endElement(RPM:Resource) SAX.characters( - libc.so, 9) + , 9) SAX.startElement(RPM:Resource) -SAX.characters(libc.so.6 - , 9) +SAX.characters(libc.so.6, 9) SAX.endElement(RPM:Resource) SAX.characters( - libdb.s, 9) + , 9) SAX.startElement(RPM:Resource) -SAX.characters(libdb.so.2 - , 10) +SAX.characters(libdb.so.2, 10) SAX.endElement(RPM:Resource) SAX.characters( - libz.so, 9) + , 9) SAX.startElement(RPM:Resource) -SAX.characters(libz.so.1 - , 9) +SAX.characters(libz.so.1, 9) SAX.endElement(RPM:Resource) SAX.characters( - /bin/ba, 9) + , 9) SAX.startElement(RPM:Resource) -SAX.characters(/bin/bash - , 9) +SAX.characters(/bin/bash, 9) SAX.endElement(RPM:Resource) SAX.characters( - /bin/sh, 9) + , 9) SAX.startElement(RPM:Resource) -SAX.characters(/bin/sh - <, 7) +SAX.characters(/bin/sh, 7) SAX.endElement(RPM:Resource) SAX.characters( - - - /bin/rpm -/usr/, 5) + , 5) SAX.startElement(RPM:Files) SAX.characters(/bin/rpm /usr/bin/find-provide, 885) SAX.endElement(RPM:Files) SAX.characters( - - , 1) SAX.endElement(RDF:RDF) SAX.endDocument() diff --git a/SAXresult/rdf2 b/SAXresult/rdf2 index bd7dbb28..076cc8ff 100644 --- a/SAXresult/rdf2 +++ b/SAXresult/rdf2 @@ -2,79 +2,71 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(RDF:RDF, xmlns:RDF='http://www.w3.org/TR/WD-rdf-syntax#', xmlns:RPM='http://www.rpm.org/') SAX.characters( - - , 8) +SAX.characters(ncurses4, 8) SAX.endElement(RPM:Resource) SAX.characters( - , 15) +SAX.characters(libncurses.so.4, 15) SAX.endElement(RPM:Resource) SAX.characters( - - , 12) +SAX.characters(libform.so.4, 12) SAX.endElement(RPM:Resource) SAX.characters( - -, 2) +, 2) SAX.startElement(g, style='fill: #f2cc99') SAX.characters( - , 2) +, 2) SAX.startElement(g, style='fill: #e5b27f') SAX.characters( - , 2) +, 2) SAX.startElement(g, style='fill: #eb8080') SAX.characters( - , 2) +, 2) SAX.startElement(g, style='fill: #f2cc99') SAX.characters( - , 2) +, 2) SAX.startElement(g, style='fill: #9c826b') SAX.characters( - , 2) +, 2) SAX.startElement(g, style='fill: #ffcc7f') SAX.characters( - -, 2) +, 2) SAX.startElement(g, style='fill: #9c826b') SAX.characters( - -, 2) +, 2) SAX.startElement(g, style='fill: #845433') SAX.characters( - -, 2) +, 2) SAX.startElement(g, style='fill: #9c826b') SAX.characters( - , 2) +, 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - , 2) +, 2) SAX.startElement(g, style='fill: #ffe5b2') SAX.characters( - -, 2) +, 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - , 5) + , 5) SAX.startElement(path, d=' M 29 28 ') SAX.endElement(path) SAX.characters( - , 5) + , 5) SAX.startElement(path, d=' L 19 74 ') SAX.endElement(path) SAX.characters( - - - -, 2) +, 2) SAX.startElement(g, style='fill: #0000ff') SAX.characters( - -, 2) +, 2) SAX.startElement(g, style='fill: #ff0000') SAX.characters( - - - - - - Java Font, 5) + , 5) SAX.startElement(g) SAX.characters( - Java Font definit, 6) + , 6) SAX.startElement(desc) SAX.characters( Java Font definition:Dialog 0, 30) SAX.endElement(desc) SAX.characters( - - - J, 5) + , 5) SAX.endElement(g) SAX.characters( - - Java Font , 4) + , 4) SAX.startElement(g) SAX.characters( - Java Font definit, 6) + , 6) SAX.startElement(desc) SAX.characters( Java Font definition:Helvetic, 35) SAX.endElement(desc) SAX.characters( - - - - - - -, 2) +, 2) SAX.startElement(g, style='fill: #800040') SAX.characters( - - -, 2) +, 2) SAX.startElement(g, style='fill: #ffffff') SAX.characters( - - Java Font, 5) + , 5) SAX.startElement(g) SAX.characters( - Java Font definit, 6) + , 6) SAX.startElement(desc) SAX.characters( Java Font definition:Dialog 7, 32) SAX.endElement(desc) SAX.characters( - - - J, 5) + , 5) SAX.endElement(g) SAX.characters( - - Java Font , 4) + , 4) SAX.startElement(g) SAX.characters( - Java Font definit, 6) + , 6) SAX.startElement(desc) SAX.characters( Java Font definition:Dialog 7, 32) SAX.endElement(desc) SAX.characters( - - - -, 5) + , 5) SAX.endElement(g) SAX.characters( - - , 1) SAX.endElement(g) SAX.endElement(svg) diff --git a/SAXresult/svg3 b/SAXresult/svg3 index cc05413d..3bb3da33 100644 --- a/SAXresult/svg3 +++ b/SAXresult/svg3 @@ -2,2815 +2,2406 @@ SAX.setDocumentLocator() SAX.startDocument() SAX.startElement(svg) SAX.characters( - - - - - - - - - , 2) + , 2) SAX.startElement(g, style='fill: #cc7226') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #e87f3a') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ea8c4d') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ec9961') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #eea575') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #f1b288') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #f3bf9c') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #f5ccb0') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #f8d8c4') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #fae5d7') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #fcf2eb') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ffffff') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #e5668c') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #b23259') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #a5264c') SAX.characters( - - - , 2) + , 2) SAX.startElement(g, style='fill: #cc3f4c') SAX.characters( - - - - - - - - , 2) + , 2) SAX.startElement(g, style='fill: #b2b2b2') SAX.characters( - - - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - - - - , 2) + , 2) SAX.startElement(g, style='fill: #e5e5b2') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #e5e5b2') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cc7226') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ea8e51') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #efaa7c') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #f4c6a8') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #f9e2d3') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ffffff') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #99cc32') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #659900') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ffffff') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cc7226') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ffffff') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #eb955c') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #f2b892') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #f8dcc8') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ffffff') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #99cc32') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #323232') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #666666') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #999999') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ffffff') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #992600') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cc7226') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cc7226') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cc7226') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cc7226') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cc7226') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cc7226') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #4c0000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #99cc32') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #659900') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #e59999') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #b26565') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #992600') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ffffff') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #992600') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ffffff') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #ffffff') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #992600') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #992600') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - - - - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - - - - - - - - - - - - - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #000000') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - - , 2) + , 2) SAX.startElement(g, style='fill: #cccccc') SAX.characters( - , 2) SAX.startElement(g, style='stroke:#000000') SAX.characters( - , 2) SAX.startElement(g, style='stroke:#000000') SAX.characters( - , 2) SAX.startElement(g, style='stroke:#000000') SAX.characters( - , 2) SAX.startElement(g, style='stroke:#000000') SAX.characters( -

Name

Synopsis

Description

Details

#define     XML_INTERNAL_GENERAL_ENTITY
#define XML_INTERNAL_GENERAL_ENTITY 1

#define     XML_EXTERNAL_GENERAL_PARSED_ENTITY
#define XML_EXTERNAL_GENERAL_PARSED_ENTITY 2

#define     XML_EXTERNAL_GENERAL_UNPARSED_ENTITY
#define XML_EXTERNAL_GENERAL_UNPARSED_ENTITY 3

#define     XML_INTERNAL_PARAMETER_ENTITY
#define XML_INTERNAL_PARAMETER_ENTITY 4

#define     XML_EXTERNAL_PARAMETER_ENTITY
#define XML_EXTERNAL_PARAMETER_ENTITY 5

#define     XML_INTERNAL_PREDEFINED_ENTITY
#define XML_INTERNAL_PREDEFINED_ENTITY 6

xmlEntityPtr

typedef xmlEntity *xmlEntityPtr;


#define     XML_MIN_ENTITIES_TABLE
#define XML_MIN_ENTITIES_TABLE 32

xmlEntitiesTablePtr

typedef xmlEntitiesTable *xmlEntitiesTablePtr;


  the document  the entity name  the entity type XML_xxx_yyy_ENTITY  the entity external ID if available  the entity system ID if available  the entity content


  the document  the entity name  the entity type XML_xxx_yyy_ENTITY  the entity external ID if available  the entity system ID if available  the entity content


  the entity name NULL if not, othervise the entity


  the document referencing the entity  the entity name A pointer to the entity structure or NULL if not found.


  the document referencing the entity  the entity name A pointer to the entity structure or NULL if not found.


  the document containing the string  A string to convert to XML. A newly allocated string with the substitution done.


  the document containing the string  A string to convert to XML. A newly allocated string with the substitution done.


 the xmlEntitiesTablePtr just created or NULL in case of error.


  An entity table the new xmlEntitiesTablePtr or NULL in case of error.


  An entity table


  An XML buffer.  An entity table

Name

Synopsis

Description

Details

htmlParserCtxt

typedef xmlParserCtxt htmlParserCtxt;


htmlParserCtxtPtr

typedef xmlParserCtxtPtr htmlParserCtxtPtr;


htmlParserNodeInfo

typedef xmlParserNodeInfo htmlParserNodeInfo;


htmlSAXHandler

typedef xmlSAXHandler htmlSAXHandler;


htmlSAXHandlerPtr

typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;


htmlParserInput

typedef xmlParserInput htmlParserInput;


htmlParserInputPtr

typedef xmlParserInputPtr htmlParserInputPtr;


htmlDocPtr

typedef xmlDocPtr htmlDocPtr;


htmlNodePtr

typedef xmlNodePtr htmlNodePtr;


  The tag name the related htmlElemDescPtr or NULL if not found.


  the entity name the associated htmlEntityDescPtr if found, NULL otherwise.


  an HTML parser context  location to store the entity name the associated htmlEntityDescPtr if found, or NULL otherwise, +if non-NULL *str will have to be freed by the caller.


  an HTML parser context the value parsed (as an int)


  an HTML parser context


  a pointer to an array of CHAR  a free form C string describing the HTML document encoding, or NULL  the SAX handler block  if using SAX, this pointer will be provided on callbacks.  the resulting document tree


  a pointer to an array of CHAR  a free form C string describing the HTML document encoding, or NULL the resulting document tree


  the filename  a free form C string describing the HTML document encoding, or NULL  the SAX handler block  if using SAX, this pointer will be provided on callbacks.  the resulting document tree


  the filename  a free form C string describing the HTML document encoding, or NULL the resulting document tree

Name

Synopsis

Description

Details






htmlDefaultSAXHandler; +int xmlParserInputRead (xmlParserInputPtr in, + int len); +int xmlParserInputGrow (xmlParserInputPtr in, + int len); CHAR

Description

Details

#define     XML_DEFAULT_VERSION
#define XML_DEFAULT_VERSION "1.0"


xmlParserInputPtr

typedef xmlParserInput *xmlParserInputPtr;


xmlParserNodeInfo

typedef _xmlParserNodeInfo xmlParserNodeInfo;


xmlParserNodeInfoSeq

typedef _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;


xmlParserNodeInfoSeqPtr


xmlParserCtxt


xmlParserCtxtPtr

typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;

xmlSAXLocator

xmlParserCtxt

typedef _xmlParserCtxt xmlParserCtxt;


xmlParserCtxtPtr

typedef xmlParserCtxt *xmlParserCtxtPtr;


xmlSAXLocator

typedef _xmlSAXLocator xmlSAXLocator;


xmlSAXLocatorPtr

typedef xmlSAXLocator *xmlSAXLocatorPtr;



























xmlSAXHandlerPtr

typedef xmlSAXHandler *xmlSAXHandlerPtr;






xmlParserInputRead ()

int         xmlParserInputRead              (xmlParserInputPtr in,
+                                             int len);

This function refresh the input for the parser. It doesn't try to +preserve pointers to the input buffer, and discard already read data

in : an XML parser input
len : an indicative size for the lookahead
Returns :the number of CHARs read, or -1 in case of error, 0 indicate the +end of this entity


xmlParserInputGrow ()

int         xmlParserInputGrow              (xmlParserInputPtr in,
+                                             int len);

This function increase the input for the parser. It tries to +preserve pointers to the input buffer, and keep already read data

in : an XML parser input
len : an indicative size for the lookahead
Returns :the number of CHARs read, or -1 in case of error, 0 indicate the +end of this entity


  the input CHAR * a new CHAR * or NULL


  the input CHAR *  the len of cur a new CHAR * or NULL


  the CHAR * array (haystack)  the index of the first char (zero based)  the length of the substring the CHAR * for the first occurence or NULL.


  the CHAR * array  the CHAR to search the CHAR * for the first occurence or NULL.


  the CHAR * array (haystack)  the CHAR to search (needle) the CHAR * for the first occurence or NULL.


  the first CHAR *  the second CHAR * the integer result of the comparison


  the first CHAR *  the second CHAR *  the max comparison length the integer result of the comparison


  the CHAR * array the number of CHAR contained in the ARRAY.


  the original CHAR * array  the CHAR * array added a new CHAR * containing the concatenated string.


  the original CHAR * array  the CHAR * array added  the length of add a new CHAR * containing the concatenated string.


  a pointer to an array of CHAR the resulting document tree


  an pointer to a char array  the size of the array the resulting document tree


  the filename the resulting document tree


  int 0 or 1  the last value for 0 for no substitution, 1 for substitution.


  a pointer to an array of CHAR the resulting document tree


  an pointer to a char array  the size of the array the resulting document tree


  the filename the resulting document tree


  an XML parser context 0, -1 in case of error. the parser context is augmented +as a result of the parsing.


  the SAX handler block  a pointer to an array of CHAR  work in recovery mode, i.e. tries to read no Well Formed +documents the resulting document tree


  the SAX handler block  an pointer to a char array  the siwe of the array  work in recovery mode, i.e. tries to read no Well Formed +documents the resulting document tree


  the SAX handler block  the filename  work in recovery mode, i.e. tries to read no Well Formed +documents the resulting document tree


  a NAME* containing the External ID of the DTD  a NAME* containing the URL to the DTD the resulting xmlDtdPtr or NULL in case of error.


  the SAX handler block  a NAME* containing the External ID of the DTD  a NAME* containing the URL to the DTD the resulting xmlDtdPtr or NULL in case of error.


  an HTML parser context


  an XML parser context


  an XML parser context  a CHAR * buffer  a file name


  an XML parser context  an XML node within the tree an xmlParserNodeInfo block pointer or NULL


  a node info sequence pointer


  a node info sequence pointer


  a node info sequence pointer  an XML node pointer a long indicating the position of the record


  an XML parser context  a node info sequence pointer



Name

Synopsis

Description

Details













  a pointer to an array of CHAR the new parser context or NULL


  the filename the new parser context or NULL


  an pointer to a char array  the siwe of the array the new parser context or NULL


  an XML parser context


  an XML parser context  an XML entity pointer.


  an XML parser context  an Entity pointer the new input stream


  an XML parser context  an XML parser input fragment (entity, XML fragment ...).


  an XML parser context the current CHAR in the parser context


  an xmlParserInputPtr


  an XML parser context  the filename to use as entity the new input stream or NULL in case of error


  an XML parser context  a CHAR **  the function returns the local part, and prefix is updated +to get the Prefix if any.


  an XML parser context the namespace name or NULL


  an XML parser context  a CHAR **  the function returns the local part, and prefix is updated +to get the Prefix if any.


  an XML parser context the namespace name


  an XML parser context the string parser or NULL.


  an XML parser context


  an XML parser context the Name parsed or NULL


  an XML parser context the Nmtoken parsed or NULL


  an XML parser context  if non-NULL store a copy of the original entity value the EntityValue parsed with reference substitued or NULL


  an XML parser context the AttValue parsed or NULL.


  an XML parser context the SystemLiteral parsed or NULL


  an XML parser context the PubidLiteral parsed or NULL.


  an XML parser context  int indicating whether we are within a CDATA section


  an XML parser context  a CHAR** receiving PubidLiteral  indicate whether we should restrict parsing to only +production [75], see NOTE below the function returns SystemLiteral and in the second +case publicID receives PubidLiteral, is strict is off +it is possible to return NULL and have publicID set.


  an XML parser context  should we create a node, or just skip the content


  an XML parser context the PITarget name or NULL


  an XML parser context


  an XML parser context


  an XML parser context


  an XML parser context  Receive a possible fixed default value for the attribute  XML_ATTRIBUTE_NONE, XML_ATTRIBUTE_REQUIRED, XML_ATTRIBUTE_IMPLIED +or XML_ATTRIBUTE_FIXED.


  an XML parser context  the notation attribute tree built while parsing


  an XML parser context  the enumeration attribute tree built while parsing


  an XML parser context  the enumeration tree built while parsing  XML_ATTRIBUTE_ENUMERATION or XML_ATTRIBUTE_NOTATION


  an XML parser context  the enumeration tree built while parsing the attribute type


  an XML parser context


  an XML parser context  the list of the xmlElementContentPtr describing the element choices


  an XML parser context  the tree of xmlElementContentPtr describing the element +hierarchy.


  an XML parser context  the name of the element being defined.  the Element Content pointer will be stored here if any  the type of element content XML_ELEMENT_TYPE_xxx


  an XML parser context the type of the element, or -1 in case of error


  an XML parser context


  an XML parser context the value parsed (as an int)


  an XML parser context the xmlEntityPtr if found, or NULL otherwise.


  an XML parser context


  an XML parser context


  an XML parser context


  an XML parser context  a CHAR ** used to store the value of the attribute the attribute name, and the value in *value.


  an XML parser context the element name parsed


  an XML parser context  the tag name as parsed in the opening tag.


  an XML parser context


  an XML parser context


  an XML parser context


  an XML parser context the string giving the XML version number, or NULL


  an XML parser context the version string, e.g. "1.0"


  an XML parser context the encoding name value or NULL


  an XML parser context the encoding value or NULL


  an XML parser context 1 if standalone, 0 otherwise


  an XML parser context


  an XML parser context


#define     XML_SUBSTITUTE_NONE
#define XML_SUBSTITUTE_NONE 0

#define     XML_SUBSTITUTE_REF
#define XML_SUBSTITUTE_REF 1

#define     XML_SUBSTITUTE_PEREF
#define XML_SUBSTITUTE_PEREF 2

#define     XML_SUBSTITUTE_BOTH
#define XML_SUBSTITUTE_BOTH 3

  the parser context  the len to decode (in bytes !), -1 for no size limit  combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF  an end marker CHAR, 0 if none  an end marker CHAR, 0 if none  an end marker CHAR, 0 if none A newly allocated string with the substitution done. The caller +must deallocate it !





Name

Synopsis

xmlBufferPtr buf, const char *str); +int xmlBufferShrink (xmlBufferPtr buf, + int len); +void xmlBufferEmpty (xmlBufferPtr buf); xmlDtdPtrCHAR *name, - CHAR *content); @@ -550,7 +565,7 @@ HREF="gnome-xml-tree.html#XMLNSPTR" HREF="gnome-xml-tree.html#CHAR" >CHAR *name, - CHAR *content); @@ -1031,7 +1046,7 @@ HREF="gnome-xml-tree.html#XMLSETCOMPRESSMODE" >

Description

Details



xmlNotationPtr

typedef xmlNotation *xmlNotationPtr;




xmlEnumerationPtr

typedef xmlEnumeration *xmlEnumerationPtr;


xmlAttributePtr

typedef xmlAttribute *xmlAttributePtr;




xmlElementContentPtr

typedef xmlElementContent *xmlElementContentPtr;



xmlElementPtr

typedef xmlElement *xmlElementPtr;



xmlNsPtr

typedef xmlNs *xmlNsPtr;


xmlDtdPtr

typedef xmlDtd *xmlDtdPtr;


xmlAttrPtr

typedef xmlAttr *xmlAttrPtr;


xmlNode

typedef _xmlNode xmlNode;


xmlNodePtr

typedef _xmlNode *xmlNodePtr;


xmlDoc

typedef _xmlDoc xmlDoc;


xmlDocPtr

typedef xmlDoc *xmlDocPtr;


xmlBuffer

typedef _xmlBuffer xmlBuffer;


xmlBufferPtr

typedef xmlBuffer *xmlBufferPtr;





 the new structure.


  the buffer to free


  the file output  the buffer to dump the number of CHAR written


  the buffer to dump  the CHAR string  the number of CHAR to add


  the buffer to dump  the CHAR string


  the buffer to dump  the C char string


xmlBufferShrink ()

int         xmlBufferShrink                 (xmlBufferPtr buf,
+                                             int len);

Remove the beginning of an XML buffer.

buf : the buffer to dump
len : the number of CHAR to remove
Returns :the number of CHAR removed, or -1 in case of failure.


xmlBufferEmpty ()

void        xmlBufferEmpty                  (xmlBufferPtr buf);

empty a buffer.

buf : the buffer


  the document pointer  the DTD name  the external ID  the system ID a pointer to the new DTD structure


  the document pointer  the DTD name  the external ID  the system ID a pointer to the new DTD structure


  the DTD structure to free up


  the document carrying the namespace  the URI associated  the prefix for the namespace returns a new namespace pointer


  the element carrying the namespace  the URI associated  the prefix for the namespace returns a new namespace pointer


  the namespace pointer


  CHAR string giving the version of XML "1.0" a new document


  pointer to the document +@:


  the document  the name of the attribute  the value of the attribute a pointer to the attribute


  the holding node  the name of the attribute  the value of the attribute a pointer to the attribute


  the first property in the list


  the first property in the list


  the attribute  a new xmlAttrPtr, or NULL in case of error.


  the first attribute  a new xmlAttrPtr, or NULL in case of error.


  the dtd  a new xmlDtdPtr, or NULL in case of error.


  the document  if 1 do a recursive copy.  a new xmlDocPtr, or NULL in case of error.


CHAR *name, - CHAR *content);  the document  namespace if any  the node name  the text content if any a pointer to the new node object.


  namespace if any  the node name a pointer to the new node object.


CHAR *name, - CHAR *content);  the parent node  a namespace if any  the name of the child  the content of the child if any. a pointer to the new node object.


  the document  the text content a pointer to the new node object.


  the text content a pointer to the new node object.


  the document  the text content  the text len. a pointer to the new node object.


  the text content  the text len. a pointer to the new node object.


  the document  the comment content a pointer to the new node object.


  the comment content a pointer to the new node object.


  the document  the reference name, or the reference string with & and ; a pointer to the new node object.


  the node  if 1 do a recursive copy.  a new xmlNodePtr, or NULL in case of error.


  the first node in the list.  a new xmlNodePtr, or NULL in case of error.


  the parent node the last child or NULL if none.


  the node 1 yes, 0 no


  the parent node  the child node the child or NULL in case of error.


  the node


  the first text node  the second text node being merged the first text node augmented


  the node  the content  content lenght


  the first node in the list


  the node


  the document  the current node  the namespace string the namespace pointer or NULL.


  the document  the current node  the namespace value the namespace pointer or NULL.


  a node in the document  a namespace pointer


  the namespace  a new xmlNsPtr, or NULL in case of error.


  the first namespace  a new xmlNsPtr, or NULL in case of error.


  the node  the attribute name  the attribute value the attribute pointer.


  the node  the attribute name the attribute value or NULL if not found.


  the document  the value of the attribute a pointer to the first child


  the document  the value of the text  the length of the string value a pointer to the first child


  the document  a Node list  should we replace entity contents or show their external form a pointer to the string copy, the calller must free it.


  the node being modified  the new value of the content


  the node being modified  the new value of the content  the size of content


  the node being modified  extra content


  the node being modified  extra content  the size of content


  the node being read a new CHAR * or NULL if no content is available. +It's up to the caller to free the memory.


  the XML buffer  the string to add


  the XML buffer output  the string to add


  the XML buffer output  the string to add


  the document  OUT: the memory pointer  OUT: the memory lenght


  the FILE*  the document


  the filename  the document  the number of file written or -1 in case of failure.


  the document 0 (uncompressed) to 9 (max compression)


  the document  the compression ratio


 0 (uncompressed) to 9 (max compression)


  the compression ratio

Name

Synopsis

Description

Details

#define     XML_MIN_NOTATION_TABLE
#define XML_MIN_NOTATION_TABLE 32

xmlNotationTablePtr

typedef xmlNotationTable *xmlNotationTablePtr;


#define     XML_MIN_ELEMENT_TABLE
#define XML_MIN_ELEMENT_TABLE 32

xmlElementTablePtr

typedef xmlElementTable *xmlElementTablePtr;


#define     XML_MIN_ATTRIBUTE_TABLE
#define XML_MIN_ATTRIBUTE_TABLE 32

xmlAttributeTablePtr

typedef xmlAttributeTable *xmlAttributeTablePtr;


  pointer to the DTD  the entity name  the public identifier or NULL  the system identifier or NULL NULL if not, othervise the entity


  A notation table the new xmlNotationTablePtr or NULL in case of error.


  An notation table


  the XML buffer output  A notation table


  the subelement name or NULL  the type of element content decl NULL if not, othervise the new element content structure


  An element content pointer. the new xmlElementContentPtr or NULL in case of error.


  the element content tree to free


  pointer to the DTD  the entity name  the element type  the element content tree or NULL NULL if not, othervise the entity


  An element table the new xmlElementTablePtr or NULL in case of error.


  An element table


  the XML buffer output  An element table


  the enumeration name or NULL the xmlEnumerationPtr just created or NULL in case +of error.


  the tree to free.


  the tree to copy. the xmlEnumerationPtr just created or NULL in case +of error.


  pointer to the DTD  the element name  the attribute name  the attribute type  the attribute default type  the attribute default value  if it's an enumeration, the associated list NULL if not, othervise the entity


  An attribute table the new xmlAttributeTablePtr or NULL in case of error.


  An attribute table


  the XML buffer output  An attribute table

Name

Synopsis

Description

Details

  an XML parser context  the message to display/transmit  extra parameters for the message display


  an XML parser context  the message to display/transmit  extra parameters for the message display

Name

Synopsis

XPATH_STRING -#define XPATH_MARKER void (*xmlXPathFunction

Description

Details

#define     XPATH_UNDEFINED
#define XPATH_UNDEFINED 0

#define     XPATH_NODESET
#define XPATH_NODESET 1

#define     XPATH_BOOLEAN
#define XPATH_BOOLEAN 2

#define     XPATH_NUMBER
#define XPATH_NUMBER 3

#define     XPATH_STRING
#define XPATH_STRING 4

XPATH_MARKER

#define     XPATH_MARKER



  the XML document  the variable list  the function list  the namespace list the xmlXPathContext just allocated.


  the context to free


  the XPath expression  the XPath context the xmlXPathObjectPtr resulting from the eveluation or NULL. +the caller has to free the object.


  the object to free


  the XPath expression  the XPath context the xmlXPathObjectPtr resulting from the eveluation or NULL. +the caller has to free the object.

+ + @@ -104,6 +106,8 @@ + + @@ -326,7 +330,6 @@ - diff --git a/encoding.c b/encoding.c index 2184f61a..8ea34490 100644 --- a/encoding.c +++ b/encoding.c @@ -445,6 +445,7 @@ xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler) { xmlCharEncodingHandlerPtr xmlGetCharEncodingHandler(xmlCharEncoding enc) { if (handlers == NULL) xmlInitCharEncodingHandlers(); + /* TODO !!!!!!! */ return(NULL); } diff --git a/include/libxml/parser.h b/include/libxml/parser.h index 65433d8c..43d183e0 100644 --- a/include/libxml/parser.h +++ b/include/libxml/parser.h @@ -31,6 +31,7 @@ typedef struct xmlParserInput { const CHAR *cur; /* Current char being parsed */ int line; /* Current line */ int col; /* Current column */ + int consumed; /* How many CHARs were already consumed */ xmlParserInputDeallocate free; /* function to deallocate the base */ } xmlParserInput; typedef xmlParserInput *xmlParserInputPtr; @@ -185,6 +186,13 @@ extern xmlSAXHandler htmlDefaultSAXHandler; #include "entities.h" #include "xml-error.h" +/* + * Input functions + */ + +int xmlParserInputRead(xmlParserInputPtr in, int len); +int xmlParserInputGrow(xmlParserInputPtr in, int len); + /* * CHAR handling */ diff --git a/include/libxml/tree.h b/include/libxml/tree.h index 0746c352..fddabb7e 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -269,6 +269,8 @@ int xmlBufferDump(FILE *file, xmlBufferPtr buf); void xmlBufferAdd(xmlBufferPtr buf, const CHAR *str, int len); void xmlBufferCat(xmlBufferPtr buf, const CHAR *str); void xmlBufferCCat(xmlBufferPtr buf, const char *str); +int xmlBufferShrink(xmlBufferPtr buf, int len); +void xmlBufferEmpty(xmlBufferPtr buf); /* * Creating/freeing new structures diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h index d6edcae2..bdeecc3f 100644 --- a/include/libxml/xmlIO.h +++ b/include/libxml/xmlIO.h @@ -11,6 +11,7 @@ #include #include "tree.h" +#include "encoding.h" #ifdef __cplusplus extern "C" { @@ -19,13 +20,10 @@ extern "C" { typedef struct xmlParserInputBuffer { /* Inputs */ FILE *file; /* Input on file handler */ + void* gzfile; /* Input on a compressed stream */ int fd; /* Input on a file descriptor */ -/********** -#ifdef HAVE_ZLIB_H - gzFile gzfile; Input on a compressed stream -#endif - */ + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */ @@ -33,6 +31,21 @@ typedef struct xmlParserInputBuffer { typedef xmlParserInputBuffer *xmlParserInputBufferPtr; +/* + * Interfaces + */ + +xmlParserInputBufferPtr xmlParserInputBufferCreateFilename(const char *filename, + xmlCharEncoding enc); +xmlParserInputBufferPtr xmlParserInputBufferCreateFile(FILE *file, + xmlCharEncoding enc); +xmlParserInputBufferPtr xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc); + +int xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len); +int xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len); + +void xmlFreeParserInputBuffer(xmlParserInputBufferPtr in); + #ifdef __cplusplus } #endif diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h index fb06e233..737b55c1 100644 --- a/include/libxml/xpath.h +++ b/include/libxml/xpath.h @@ -37,13 +37,12 @@ typedef struct xmlNodeSet { #define XPATH_BOOLEAN 2 #define XPATH_NUMBER 3 #define XPATH_STRING 4 -#define XPATH_MARKER 5 /* used for func call checks */ typedef struct xmlXPathObject { int type; xmlNodeSetPtr nodesetval; int boolval; - float floatval; + double floatval; CHAR *stringval; } xmlXPathObject, *xmlXPathObjectPtr; diff --git a/parser.c b/parser.c index 97c2add3..2bc3d879 100644 --- a/parser.c +++ b/parser.c @@ -33,9 +33,189 @@ #include "encoding.h" #include "valid.h" #include "parserInternals.h" +#include "xmlIO.h" const char *xmlParserVersion = LIBXML_VERSION; +#define XML_MAX_NAMELEN 1000 + +/************************************************************************ + * * + * Input handling functions for progressive parsing * + * * + ************************************************************************/ + +/* #define DEBUG_INPUT */ + +#define INPUT_CHUNK 50 + +#ifdef DEBUG_INPUT +#define CHECK_BUFFER(in) check_buffer(in) +#else +#define CHECK_BUFFER(in) +#endif + +void check_buffer(xmlParserInputPtr in) { + if (in->base != in->buf->buffer->content) { + fprintf(stderr, "xmlParserInput: base mismatch problem\n"); + } + if (in->cur < in->base) { + fprintf(stderr, "xmlParserInput: cur < base problem\n"); + } + if (in->cur > in->base + in->buf->buffer->use) { + fprintf(stderr, "xmlParserInput: cur > base + use problem\n"); + } + fprintf(stderr,"buffer %x : content %x, cur %d, use %d, size %d\n", + (int) in, (int) in->buf->buffer->content, in->cur - in->base, + in->buf->buffer->use, in->buf->buffer->size); +} + + +/** + * xmlParserInputRead: + * @in: an XML parser input + * @len: an indicative size for the lookahead + * + * This function refresh the input for the parser. It doesn't try to + * preserve pointers to the input buffer, and discard already read data + * + * Returns the number of CHARs read, or -1 in case of error, 0 indicate the + * end of this entity + */ +int +xmlParserInputRead(xmlParserInputPtr in, int len) { + int ret; + int used; + int index; + +#ifdef DEBUG_INPUT + fprintf(stderr, "Read\n"); +#endif + if (in->buf == NULL) return(-1); + if (in->base == NULL) return(-1); + if (in->cur == NULL) return(-1); + if (in->buf->buffer == NULL) return(-1); + + CHECK_BUFFER(in); + + used = in->cur - in->buf->buffer->content; + ret = xmlBufferShrink(in->buf->buffer, used); + if (ret > 0) { + in->cur -= ret; + in->consumed += ret; + } + ret = xmlParserInputBufferRead(in->buf, len); + if (in->base != in->buf->buffer->content) { + /* + * the buffer has been realloced + */ + index = in->cur - in->base; + in->base = in->buf->buffer->content; + in->cur = &in->buf->buffer->content[index]; + } + + CHECK_BUFFER(in); + + return(ret); +} + +/** + * xmlParserInputGrow: + * @in: an XML parser input + * @len: an indicative size for the lookahead + * + * This function increase the input for the parser. It tries to + * preserve pointers to the input buffer, and keep already read data + * + * Returns the number of CHARs read, or -1 in case of error, 0 indicate the + * end of this entity + */ +int +xmlParserInputGrow(xmlParserInputPtr in, int len) { + int ret; + int index; + +#ifdef DEBUG_INPUT + fprintf(stderr, "Grow\n"); +#endif + if (in->buf == NULL) return(-1); + if (in->base == NULL) return(-1); + if (in->cur == NULL) return(-1); + if (in->buf->buffer == NULL) return(-1); + + CHECK_BUFFER(in); + + index = in->cur - in->base; + if (in->buf->buffer->use > index + INPUT_CHUNK) { + + CHECK_BUFFER(in); + + return(0); + } + ret = xmlParserInputBufferGrow(in->buf, len); + if (in->base != in->buf->buffer->content) { + /* + * the buffer has been realloced + */ + index = in->cur - in->base; + in->base = in->buf->buffer->content; + in->cur = &in->buf->buffer->content[index]; + } + + CHECK_BUFFER(in); + + return(ret); +} + +/** + * xmlParserInputShrink: + * @in: an XML parser input + * + * This function removes used input for the parser. + */ +void +xmlParserInputShrink(xmlParserInputPtr in) { + int used; + int ret; + int index; + +#ifdef DEBUG_INPUT + fprintf(stderr, "Shrink\n"); +#endif + if (in->buf == NULL) return; + if (in->base == NULL) return; + if (in->cur == NULL) return; + if (in->buf->buffer == NULL) return; + + CHECK_BUFFER(in); + + used = in->cur - in->buf->buffer->content; + if (used > INPUT_CHUNK) { + ret = xmlBufferShrink(in->buf->buffer, used); + if (ret > 0) { + in->cur -= ret; + in->consumed += ret; + } + } + + CHECK_BUFFER(in); + + if (in->buf->buffer->use > INPUT_CHUNK) { + return; + } + xmlParserInputBufferRead(in->buf, 2 * INPUT_CHUNK); + if (in->base != in->buf->buffer->content) { + /* + * the buffer has been realloced + */ + index = in->cur - in->base; + in->base = in->buf->buffer->content; + in->cur = &in->buf->buffer->content[index]; + } + + CHECK_BUFFER(in); +} + /************************************************************************ * * * Parser stacks related functions and macros * @@ -102,7 +282,6 @@ PUSH_AND_POP(xmlNodePtr, node) * UTF-8 if we are using this mode. It returns an int. * NEXT Skip to the next character, this does the proper decoding * in UTF-8 mode. It also pop-up unfinished entities on the fly. - * It returns the pointer to the current CHAR. * COPY(to) copy one char to *to, increment CUR_PTR and to accordingly */ @@ -110,17 +289,41 @@ PUSH_AND_POP(xmlNodePtr, node) #define SKIP(val) ctxt->input->cur += (val) #define NXT(val) ctxt->input->cur[(val)] #define CUR_PTR ctxt->input->cur +#define SHRINK xmlParserInputShrink(ctxt->input) +#define GROW xmlParserInputGrow(ctxt->input, INPUT_CHUNK) #define SKIP_BLANKS \ while (IS_BLANK(*(ctxt->input->cur))) NEXT #ifndef USE_UTF_8 #define CURRENT (*ctxt->input->cur) +#define NEXT { \ + if ((*ctxt->input->cur == 0) && \ + (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0)) { \ + xmlPopInput(ctxt); \ + } else { \ + if (*(ctxt->input->cur) == '\n') { \ + ctxt->input->line++; ctxt->input->col = 1; \ + } else ctxt->input->col++; \ + ctxt->input->cur++; \ + if (*ctxt->input->cur == 0) \ + xmlParserInputGrow(ctxt->input, INPUT_CHUNK); \ + }} + +/**************************************** #define NEXT ((*ctxt->input->cur) ? \ (((*(ctxt->input->cur) == '\n') ? \ (ctxt->input->line++, ctxt->input->col = 1) : \ - (ctxt->input->col++)), ctxt->input->cur++) : \ - (xmlPopInput(ctxt), ctxt->input->cur)) + (ctxt->input->col++)), \ + (ctxt->input->cur++), \ + ((*ctxt->input->cur) ? \ + (xmlParserInputGrow(ctxt->input, 100), \ + ctxt->input->cur): \ + (ctxt->input->cur))) : \ + ((xmlParserInputGrow(ctxt->input, 100) > 0) ? \ + ctxt->input->cur: \ + (xmlPopInput(ctxt), ctxt->input->cur))) + ****************************************/ #else #endif @@ -170,6 +373,8 @@ xmlFreeInputStream(xmlParserInputPtr input) { if (input->filename != NULL) free((char *) input->filename); if ((input->free != NULL) && (input->base != NULL)) input->free((char *) input->base); + if (input->buf != NULL) + xmlFreeParserInputBuffer(input->buf); memset(input, -1, sizeof(xmlParserInput)); free(input); } @@ -207,9 +412,12 @@ xmlNewEntityInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) { input->filename = entity->SystemID; /* TODO !!! char <- CHAR */ input->base = entity->content; input->cur = entity->content; + input->buf = NULL; input->line = 1; input->col = 1; + input->buf = NULL; input->free = NULL; + input->consumed = 0; return(input); } @@ -240,9 +448,11 @@ xmlNewStringInputStream(xmlParserCtxtPtr ctxt, CHAR *entity) { input->filename = NULL; input->base = entity; input->cur = entity; + input->buf = NULL; input->line = 1; input->col = 1; input->free = NULL; + input->consumed = 0; return(input); } @@ -257,114 +467,11 @@ xmlNewStringInputStream(xmlParserCtxtPtr ctxt, CHAR *entity) { */ xmlParserInputPtr xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) { -#ifdef HAVE_ZLIB_H - gzFile input; -#else - int input; -#endif - int res; - int len; - int cnt; - struct stat buf; - char *buffer, *nbuf; + xmlParserInputBufferPtr buf; xmlParserInputPtr inputStream; - /* xmlCharEncoding enc; */ -#define MINLEN 40000 - - if (strcmp(filename,"-") == 0) { -#ifdef HAVE_ZLIB_H - input = gzdopen (fileno(stdin), "r"); - if (input == NULL) { - fprintf (stderr, "Cannot read from stdin\n"); - perror ("gzdopen failed"); - return(NULL); - } -#else -#ifdef WIN32 - input = -1; -#else - input = fileno(stdin); -#endif - if (input < 0) { - fprintf (stderr, "Cannot read from stdin\n"); - perror ("open failed"); - return(NULL); - } -#endif - len = MINLEN; - } else { -#ifdef HAVE_ZLIB_H - input = gzopen (filename, "r"); - if (input == NULL) { - fprintf (stderr, "Cannot read file %s :\n", filename); - perror ("gzopen failed"); - return(NULL); - } -#else -#ifdef WIN32 - input = _open (filename, O_RDONLY | _O_BINARY); -#else - input = open (filename, O_RDONLY); -#endif - if (input < 0) { - fprintf (stderr, "Cannot read file %s :\n", filename); - perror ("open failed"); - return(NULL); - } -#endif - res = stat(filename, &buf); - if (res < 0) - return(NULL); - len = buf.st_size; - if (len < MINLEN) - len = MINLEN; - } - buffer = (char *)malloc((len+1)*sizeof(char)); - if (buffer == NULL) { - fprintf (stderr, "Cannot malloc\n"); - perror ("malloc failed"); - return(NULL); - } - - cnt = 0; - while(1) { - if (cnt >= len) { - len *= 2; - nbuf = (char *)realloc(buffer,(len+1)*sizeof(char)); - if (nbuf == NULL) { - fprintf(stderr,"Cannot realloc\n"); - free(buffer); - perror ("realloc failed"); - return(NULL); - } - buffer = nbuf; - } -#ifdef HAVE_ZLIB_H - res = gzread(input, &buffer[cnt], len-cnt); -#else - res = read(input, &buffer[cnt], len-cnt); -#endif - if (res < 0) { - fprintf (stderr, "Cannot read file %s :\n", filename); -#ifdef HAVE_ZLIB_H - perror ("gzread failed"); -#else - perror ("read failed"); -#endif - return(NULL); - } - if (res == 0) - break; - cnt += res; - } -#ifdef HAVE_ZLIB_H - gzclose(input); -#else - close(input); -#endif - - buffer[cnt] = '\0'; + buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE); + if (buf == NULL) return(NULL); inputStream = (xmlParserInputPtr) malloc(sizeof(xmlParserInput)); if (inputStream == NULL) { @@ -376,16 +483,12 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) { inputStream->filename = strdup(filename); inputStream->line = 1; inputStream->col = 1; + inputStream->buf = buf; - /* - * plug some encoding conversion routines here. !!! - enc = xmlDetectCharEncoding(buffer); - xmlSwitchEncoding(ctxt, enc); - */ - - inputStream->base = buffer; - inputStream->cur = buffer; - inputStream->free = (xmlParserInputDeallocate) free; + inputStream->base = inputStream->buf->buffer->content; + inputStream->cur = inputStream->buf->buffer->content; + inputStream->free = NULL; + inputStream->consumed = 0; return(inputStream); } @@ -434,7 +537,7 @@ xmlDecodeEntities(xmlParserCtxtPtr ctxt, int len, int what, CHAR *cur = NULL; xmlEntityPtr ent; - const CHAR *start = CUR_PTR; + int nbchars = 0; unsigned int max = (unsigned int) len; /* @@ -451,7 +554,7 @@ xmlDecodeEntities(xmlParserCtxtPtr ctxt, int len, int what, /* * Ok loop until we reach one of the ending char or a size limit. */ - while ((CUR_PTR - start < max) && (CUR != end) && + while ((nbchars < max) && (CUR != end) && (CUR != end2) && (CUR != end3)) { if (CUR == '&' && (what & XML_SUBSTITUTE_REF)) { @@ -459,6 +562,7 @@ xmlDecodeEntities(xmlParserCtxtPtr ctxt, int len, int what, int val = xmlParseCharRef(ctxt); /* TODO: invalid for UTF-8 variable encoding !!! */ *out++ = val; + nbchars += 3; /* !!!! */ } else { ent = xmlParseEntityRef(ctxt); if (ent != NULL) { @@ -472,6 +576,7 @@ xmlDecodeEntities(xmlParserCtxtPtr ctxt, int len, int what, out = &buffer[index]; } } + nbchars += 3 + xmlStrlen(ent->name); } } } else if (CUR == '%' && (what & XML_SUBSTITUTE_PEREF)) { @@ -480,7 +585,7 @@ xmlDecodeEntities(xmlParserCtxtPtr ctxt, int len, int what, * we break here to flush the current set of chars * parsed if any. We will be called back later. */ - if (CUR_PTR != start) break; + if (nbchars != 0) break; xmlParsePEReference(ctxt); @@ -494,6 +599,7 @@ xmlDecodeEntities(xmlParserCtxtPtr ctxt, int len, int what, } else { /* TODO: invalid for UTF-8 , use COPY(out); */ *out++ = CUR; + nbchars++; if (out - buffer > buffer_size - 100) { int index = out - buffer; @@ -1031,22 +1137,31 @@ void xmlParseReference(xmlParserCtxtPtr ctxt); CHAR * xmlNamespaceParseNCName(xmlParserCtxtPtr ctxt) { - const CHAR *q; - CHAR *ret = NULL; + CHAR buf[XML_MAX_NAMELEN]; + int len = 0; if (!IS_LETTER(CUR) && (CUR != '_')) return(NULL); - q = NEXT; while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || (CUR == '.') || (CUR == '-') || (CUR == '_') || (IS_COMBINING(CUR)) || - (IS_EXTENDER(CUR))) + (IS_EXTENDER(CUR))) { + buf[len++] = CUR; NEXT; - - ret = xmlStrndup(q, CUR_PTR - q); - - return(ret); + if (len >= XML_MAX_NAMELEN) { + fprintf(stderr, + "xmlNamespaceParseNCName: reached XML_MAX_NAMELEN limit\n"); + while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || + (CUR == '.') || (CUR == '-') || + (CUR == '_') || + (IS_COMBINING(CUR)) || + (IS_EXTENDER(CUR))) + NEXT; + break; + } + } + return(xmlStrndup(buf, len)); } /** @@ -1282,7 +1397,7 @@ xmlParseNamespace(xmlParserCtxtPtr ctxt) { SKIP_BLANKS; } else if ((CUR == '?') && (NXT(1) == '>')) { garbage = 0; - CUR_PTR ++; + NEXT; } else { /* * Found garbage when parsing the namespace @@ -1334,23 +1449,35 @@ xmlParseNamespace(xmlParserCtxtPtr ctxt) { CHAR * xmlParseName(xmlParserCtxtPtr ctxt) { - const CHAR *q; - CHAR *ret = NULL; + CHAR buf[XML_MAX_NAMELEN]; + int len = 0; + GROW; if (!IS_LETTER(CUR) && (CUR != '_') && - (CUR != ':')) return(NULL); - q = NEXT; + (CUR != ':')) { + return(NULL); + } while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || (CUR == '.') || (CUR == '-') || (CUR == '_') || (CUR == ':') || (IS_COMBINING(CUR)) || - (IS_EXTENDER(CUR))) + (IS_EXTENDER(CUR))) { + buf[len++] = CUR; NEXT; - - ret = xmlStrndup(q, CUR_PTR - q); - - return(ret); + if (len >= XML_MAX_NAMELEN) { + fprintf(stderr, + "xmlParseName: reached XML_MAX_NAMELEN limit\n"); + while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || + (CUR == '.') || (CUR == '-') || + (CUR == '_') || (CUR == ':') || + (IS_COMBINING(CUR)) || + (IS_EXTENDER(CUR))) + NEXT; + break; + } + } + return(xmlStrndup(buf, len)); } /** @@ -1368,21 +1495,30 @@ xmlParseName(xmlParserCtxtPtr ctxt) { CHAR * xmlParseNmtoken(xmlParserCtxtPtr ctxt) { - const CHAR *q; - CHAR *ret = NULL; - - q = NEXT; + CHAR buf[XML_MAX_NAMELEN]; + int len = 0; + GROW; while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || (CUR == '.') || (CUR == '-') || (CUR == '_') || (CUR == ':') || (IS_COMBINING(CUR)) || - (IS_EXTENDER(CUR))) + (IS_EXTENDER(CUR))) { + buf[len++] = CUR; NEXT; - - ret = xmlStrndup(q, CUR_PTR - q); - - return(ret); + if (len >= XML_MAX_NAMELEN) { + fprintf(stderr, + "xmlParseNmtoken: reached XML_MAX_NAMELEN limit\n"); + while ((IS_LETTER(CUR)) || (IS_DIGIT(CUR)) || + (CUR == '.') || (CUR == '-') || + (CUR == '_') || (CUR == ':') || + (IS_COMBINING(CUR)) || + (IS_EXTENDER(CUR))) + NEXT; + break; + } + } + return(xmlStrndup(buf, len)); } /** @@ -1405,6 +1541,7 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, CHAR **orig) { const CHAR *tst = NULL; const CHAR *temp = NULL; + SHRINK; if (CUR == '"') { NEXT; org = CUR_PTR; @@ -1471,6 +1608,7 @@ CHAR * xmlParseAttValue(xmlParserCtxtPtr ctxt) { CHAR *ret = NULL; + SHRINK; if (CUR == '"') { NEXT; if (ctxt->replaceEntities != 0) @@ -1532,6 +1670,7 @@ xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { const CHAR *q; CHAR *ret = NULL; + SHRINK; if (CUR == '"') { NEXT; q = CUR_PTR; @@ -1585,6 +1724,7 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { /* * Name ::= (Letter | '_') (NameChar)* */ + SHRINK; if (CUR == '"') { NEXT; q = CUR_PTR; @@ -1632,9 +1772,10 @@ xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { void xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) { - const CHAR *q; + CHAR buf[1000]; + int nbchar = 0; - q = CUR_PTR; + SHRINK; while ((IS_CHAR(CUR)) && (CUR != '<') && (CUR != '&')) { if ((CUR == ']') && (NXT(1) == ']') && @@ -1647,21 +1788,38 @@ xmlParseCharData(xmlParserCtxtPtr ctxt, int cdata) { ctxt->wellFormed = 0; } } + buf[nbchar++] = CUR; + if (nbchar == 1000) { + /* + * Ok the segment is to be consumed as chars. + */ + if (ctxt->sax != NULL) { + if (areBlanks(ctxt, buf, nbchar)) { + if (ctxt->sax->ignorableWhitespace != NULL) + ctxt->sax->ignorableWhitespace(ctxt->userData, + buf, nbchar); + } else { + if (ctxt->sax->characters != NULL) + ctxt->sax->characters(ctxt->userData, buf, nbchar); + } + } + nbchar = 0; + } NEXT; } - if (q == CUR_PTR) return; - - /* - * Ok the segment [q CUR_PTR] is to be consumed as chars. - */ - if (ctxt->sax != NULL) { - if (areBlanks(ctxt, q, CUR_PTR - q)) { - if (ctxt->sax->ignorableWhitespace != NULL) - ctxt->sax->ignorableWhitespace(ctxt->userData, q, CUR_PTR - q); - } else { - if (ctxt->sax->characters != NULL) - ctxt->sax->characters(ctxt->userData, q, CUR_PTR - q); - } + if (nbchar != 0) { + /* + * Ok the segment is to be consumed as chars. + */ + if (ctxt->sax != NULL) { + if (areBlanks(ctxt, buf, nbchar)) { + if (ctxt->sax->ignorableWhitespace != NULL) + ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar); + } else { + if (ctxt->sax->characters != NULL) + ctxt->sax->characters(ctxt->userData, buf, nbchar); + } + } } } @@ -1691,6 +1849,7 @@ CHAR * xmlParseExternalID(xmlParserCtxtPtr ctxt, CHAR **publicID, int strict) { CHAR *URI = NULL; + SHRINK; if ((CUR == 'S') && (NXT(1) == 'Y') && (NXT(2) == 'S') && (NXT(3) == 'T') && (NXT(4) == 'E') && (NXT(5) == 'M')) { @@ -1785,6 +1944,7 @@ xmlParseComment(xmlParserCtxtPtr ctxt, int create) { if ((CUR != '<') || (NXT(1) != '!') || (NXT(2) != '-') || (NXT(3) != '-')) return; + SHRINK; SKIP(4); start = q = CUR_PTR; NEXT; @@ -1863,6 +2023,7 @@ xmlParsePI(xmlParserCtxtPtr ctxt) { * this is a Processing Instruction. */ SKIP(2); + SHRINK; /* * Parse the target name and check for special support like @@ -1943,6 +2104,7 @@ xmlParseNotationDecl(xmlParserCtxtPtr ctxt) { (NXT(4) == 'T') && (NXT(5) == 'A') && (NXT(6) == 'T') && (NXT(7) == 'I') && (NXT(8) == 'O') && (NXT(9) == 'N')) { + SHRINK; SKIP(10); if (!IS_BLANK(CUR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) @@ -2022,6 +2184,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) { (NXT(2) == 'E') && (NXT(3) == 'N') && (NXT(4) == 'T') && (NXT(5) == 'I') && (NXT(6) == 'T') && (NXT(7) == 'Y')) { + SHRINK; SKIP(8); if (!IS_BLANK(CUR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) @@ -2228,6 +2391,7 @@ xmlParseNotationType(xmlParserCtxtPtr ctxt) { ctxt->wellFormed = 0; return(NULL); } + SHRINK; do { NEXT; SKIP_BLANKS; @@ -2283,6 +2447,7 @@ xmlParseEnumerationType(xmlParserCtxtPtr ctxt) { ctxt->wellFormed = 0; return(NULL); } + SHRINK; do { NEXT; SKIP_BLANKS; @@ -2371,6 +2536,7 @@ xmlParseEnumeratedType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) { */ int xmlParseAttributeType(xmlParserCtxtPtr ctxt, xmlEnumerationPtr *tree) { + SHRINK; if ((CUR == 'C') && (NXT(1) == 'D') && (NXT(2) == 'A') && (NXT(3) == 'T') && (NXT(4) == 'A')) { @@ -2544,6 +2710,7 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt) { (NXT(6) == 'A')) { SKIP(7); SKIP_BLANKS; + SHRINK; if (CUR == ')') { NEXT; ret = xmlNewElementContent(NULL, XML_ELEMENT_CONTENT_PCDATA); @@ -2670,6 +2837,7 @@ xmlParseElementChildrenContentDecl(xmlParserCtxtPtr ctxt) { free(elem); } SKIP_BLANKS; + SHRINK; while (CUR != ')') { /* * Each loop we parse one separator and one element. @@ -3255,11 +3423,10 @@ xmlParseReference(xmlParserCtxtPtr ctxt) { */ xmlEntityPtr xmlParseEntityRef(xmlParserCtxtPtr ctxt) { - const CHAR *q; /* !!!!!!!!!!! Unused !!!!!!!!!! */ CHAR *name; xmlEntityPtr ent = NULL; - q = CUR_PTR; + GROW; if (CUR == '&') { NEXT; name = xmlParseName(ctxt); @@ -3607,10 +3774,12 @@ xmlParseStartTag(xmlParserCtxtPtr ctxt) { * (S Attribute)* S? */ SKIP_BLANKS; + GROW; while ((IS_CHAR(CUR)) && (CUR != '>') && ((CUR != '/') || (NXT(1) != '>'))) { const CHAR *q = CUR_PTR; + int cons = ctxt->input->consumed; attname = xmlParseAttribute(ctxt, &attvalue); if ((attname != NULL) && (attvalue != NULL)) { @@ -3656,13 +3825,14 @@ xmlParseStartTag(xmlParserCtxtPtr ctxt) { } SKIP_BLANKS; - if (q == CUR_PTR) { + if ((cons == ctxt->input->consumed) && (q == CUR_PTR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlParseStartTag: problem parsing attributes\n"); ctxt->wellFormed = 0; break; } + GROW; } /* @@ -3696,6 +3866,7 @@ void xmlParseEndTag(xmlParserCtxtPtr ctxt, CHAR *tagname) { CHAR *name; + GROW; if ((CUR != '<') || (NXT(1) != '/')) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "xmlParseEndTag: ''" part */ + GROW; SKIP_BLANKS; if ((!IS_CHAR(CUR)) || (CUR != '>')) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) @@ -3772,14 +3944,16 @@ xmlParseCDSect(xmlParserCtxtPtr ctxt) { ctxt->wellFormed = 0; return; } - r = NEXT; + r = CUR_PTR; + NEXT; if (!IS_CHAR(CUR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "CData section not finished\n%.50s\n", base); ctxt->wellFormed = 0; return; } - s = NEXT; + s = CUR_PTR; + NEXT; while (IS_CHAR(CUR) && ((*r != ']') || (*s != ']') || (CUR != '>'))) { r++;s++;NEXT; @@ -3819,6 +3993,7 @@ void xmlParseContent(xmlParserCtxtPtr ctxt) { while ((CUR != '<') || (NXT(1) != '/')) { const CHAR *test = CUR_PTR; + int cons = ctxt->input->consumed; /* * First case : a Processing Instruction. @@ -3868,13 +4043,14 @@ xmlParseContent(xmlParserCtxtPtr ctxt) { xmlParseCharData(ctxt, 0); } + GROW; /* * Pop-up of finished entities. */ while ((CUR == 0) && (ctxt->inputNr > 1)) xmlPopInput(ctxt); - if (test == CUR_PTR) { + if ((cons == ctxt->input->consumed) && (test == CUR_PTR)) { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "detected an error in element content\n"); @@ -3920,8 +4096,9 @@ xmlParseElement(xmlParserCtxtPtr ctxt) { free(name); return; } - if (CUR == '>') NEXT; - else { + if (CUR == '>') { + NEXT; + } else { if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Couldn't find end of Start Tag\n%.30s\n", openTag); @@ -4349,6 +4526,8 @@ int xmlParseDocument(xmlParserCtxtPtr ctxt) { xmlDefaultSAXHandlerInit(); + GROW; + /* * SAX: beginning of the document processing. */ @@ -4380,6 +4559,7 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) { /* * Check for the XMLDecl in the Prolog. */ + GROW; if ((CUR == '<') && (NXT(1) == '?') && (NXT(2) == 'x') && (NXT(3) == 'm') && (NXT(4) == 'l')) { @@ -4405,12 +4585,14 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) { /* * The Misc part of the Prolog */ + GROW; xmlParseMisc(ctxt); /* * Then possibly doc type declaration(s) and more Misc * (doctypedecl Misc*)? */ + GROW; if ((CUR == '<') && (NXT(1) == '!') && (NXT(2) == 'D') && (NXT(3) == 'O') && (NXT(4) == 'C') && (NXT(5) == 'T') && @@ -4423,6 +4605,7 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) { /* * Time to start parsing the tree itself */ + GROW; xmlParseElement(ctxt); /* @@ -4484,7 +4667,9 @@ xmlCreateDocParserCtxt(CHAR *cur) { input->col = 1; input->base = cur; input->cur = cur; + input->buf = NULL; input->free = NULL; + input->consumed = 0; inputPush(ctxt, input); return(ctxt); @@ -4580,6 +4765,8 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const CHAR *ExternalID, */ if (ctxt == NULL) return(NULL); if (sax != NULL) { + if (ctxt->sax != NULL) + free(ctxt->sax); ctxt->sax = sax; ctxt->userData = NULL; } @@ -4675,114 +4862,11 @@ xmlParserCtxtPtr xmlCreateFileParserCtxt(const char *filename) { xmlParserCtxtPtr ctxt; -#ifdef HAVE_ZLIB_H - gzFile input; -#else - int input; -#endif - int res; - int len; - int cnt; - struct stat buf; - char *buffer, *nbuf; xmlParserInputPtr inputStream; - xmlCharEncoding enc; + xmlParserInputBufferPtr buf; -#define MINLEN 40000 - - if (strcmp(filename,"-") == 0) { -#ifdef HAVE_ZLIB_H - input = gzdopen (fileno(stdin), "r"); - if (input == NULL) { - fprintf (stderr, "Cannot read from stdin\n"); - perror ("gzdopen failed"); - return(NULL); - } -#else -#ifdef WIN32 - input = -1; -#else - input = fileno(stdin); -#endif - if (input < 0) { - fprintf (stderr, "Cannot read from stdin\n"); - perror ("open failed"); - return(NULL); - } -#endif - len = MINLEN; - } else { -#ifdef HAVE_ZLIB_H - input = gzopen (filename, "r"); - if (input == NULL) { - fprintf (stderr, "Cannot read file %s :\n", filename); - perror ("gzopen failed"); - return(NULL); - } -#else -#ifdef WIN32 - input = _open (filename, O_RDONLY | _O_BINARY); -#else - input = open (filename, O_RDONLY); -#endif - if (input < 0) { - fprintf (stderr, "Cannot read file %s :\n", filename); - perror ("open failed"); - return(NULL); - } -#endif - res = stat(filename, &buf); - if (res < 0) - return(NULL); - len = buf.st_size; - if (len < MINLEN) - len = MINLEN; - } - buffer = (char *)malloc((len+1)*sizeof(char)); - if (buffer == NULL) { - fprintf (stderr, "Cannot malloc\n"); - perror ("malloc failed"); - return(NULL); - } - - cnt = 0; - while(1) { - if (cnt == len) { - len *= 2; - nbuf = (char *)realloc(buffer,(len+1)*sizeof(char)); - if (nbuf == NULL) { - fprintf(stderr,"Cannot realloc\n"); - free(buffer); - perror ("realloc failed"); - return(NULL); - } - buffer = nbuf; - } -#ifdef HAVE_ZLIB_H - res = gzread(input, &buffer[cnt], len-cnt); -#else - res = read(input, &buffer[cnt], len-cnt); -#endif - if (res < 0) { - fprintf (stderr, "Cannot read file %s :\n", filename); -#ifdef HAVE_ZLIB_H - perror ("gzread failed"); -#else - perror ("read failed"); -#endif - return(NULL); - } - if (res == 0) - break; - cnt += res; - } -#ifdef HAVE_ZLIB_H - gzclose(input); -#else - close(input); -#endif - - buffer[cnt] = '\0'; + buf = xmlParserInputBufferCreateFilename(filename, XML_CHAR_ENCODING_NONE); + if (buf == NULL) return(NULL); ctxt = (xmlParserCtxtPtr) malloc(sizeof(xmlParserCtxt)); if (ctxt == NULL) { @@ -4800,16 +4884,12 @@ xmlCreateFileParserCtxt(const char *filename) inputStream->filename = strdup(filename); inputStream->line = 1; inputStream->col = 1; + inputStream->buf = buf; + inputStream->consumed = 0; - /* - * plug some encoding conversion routines here. !!! - */ - enc = xmlDetectCharEncoding(buffer); - xmlSwitchEncoding(ctxt, enc); - - inputStream->base = buffer; - inputStream->cur = buffer; - inputStream->free = (xmlParserInputDeallocate) free; + inputStream->base = inputStream->buf->buffer->content; + inputStream->cur = inputStream->buf->buffer->content; + inputStream->free = NULL; inputPush(ctxt, inputStream); return(ctxt); @@ -4839,6 +4919,8 @@ xmlSAXParseFile(xmlSAXHandlerPtr sax, const char *filename, ctxt = xmlCreateFileParserCtxt(filename); if (ctxt == NULL) return(NULL); if (sax != NULL) { + if (ctxt->sax != NULL) + free(ctxt->sax); ctxt->sax = sax; ctxt->userData = NULL; } @@ -4946,6 +5028,7 @@ xmlCreateMemoryParserCtxt(char *buffer, int size) { input->filename = NULL; input->line = 1; input->col = 1; + input->consumed = 0; /* * plug some encoding conversion routines here. !!! diff --git a/parser.h b/parser.h index 65433d8c..43d183e0 100644 --- a/parser.h +++ b/parser.h @@ -31,6 +31,7 @@ typedef struct xmlParserInput { const CHAR *cur; /* Current char being parsed */ int line; /* Current line */ int col; /* Current column */ + int consumed; /* How many CHARs were already consumed */ xmlParserInputDeallocate free; /* function to deallocate the base */ } xmlParserInput; typedef xmlParserInput *xmlParserInputPtr; @@ -185,6 +186,13 @@ extern xmlSAXHandler htmlDefaultSAXHandler; #include "entities.h" #include "xml-error.h" +/* + * Input functions + */ + +int xmlParserInputRead(xmlParserInputPtr in, int len); +int xmlParserInputGrow(xmlParserInputPtr in, int len); + /* * CHAR handling */ diff --git a/result/XPath/tests/simpleabbr b/result/XPath/tests/simpleabbr index cca499de..774addb9 100644 --- a/result/XPath/tests/simpleabbr +++ b/result/XPath/tests/simpleabbr @@ -22,4 +22,6 @@ Set contains 1 nodes: 1 TEXT content=bla bla bla ... Object is a Node Set : -Set contains 0 nodes: +Set contains 1 nodes: +1 TEXT + content=... diff --git a/testSAX.c b/testSAX.c index 1e7acb1b..c64bc3cd 100644 --- a/testSAX.c +++ b/testSAX.c @@ -388,7 +388,12 @@ endElementDebug(xmlParserCtxtPtr ctxt, const CHAR *name) void charactersDebug(xmlParserCtxtPtr ctxt, const CHAR *ch, int len) { - fprintf(stdout, "SAX.characters(%.30s, %d)\n", (char *) ch, len); + int i; + + fprintf(stdout, "SAX.characters("); + for (i = 0;(i < len) && (i < 30);i++) + fprintf(stdout, "%c", ch[i]); + fprintf(stdout, ", %d)\n", len); } /** diff --git a/testXPath.c b/testXPath.c index cf856f0c..1342ffbf 100644 --- a/testXPath.c +++ b/testXPath.c @@ -125,6 +125,7 @@ void testXPath(const char *str) { res = xmlXPathEval(str, ctxt); xmlXPAthDebugDumpObject(stdout, res); xmlXPathFreeObject(res); + xmlXPathFreeContext(ctxt); } void testXPathFile(const char *filename) { diff --git a/tester.c b/tester.c index 43005f13..af7722e9 100644 --- a/tester.c +++ b/tester.c @@ -34,6 +34,7 @@ static int debug = 0; static int copy = 0; static int recovery = 0; static int noent = 0; +static int noout = 0; /* * Note: there is a couple of errors introduced on purpose. @@ -96,7 +97,8 @@ int treeTest(void) { /* * print it. */ - xmlDocDump(stdout, doc); + if (noout == 0) + xmlDocDump(stdout, doc); /* * free it. @@ -128,10 +130,12 @@ void parseAndPrintFile(char *filename) { /* * print it. */ - if (!debug) - xmlDocDump(stdout, doc); - else - xmlDebugDumpDocument(stdout, doc); + if (noout == 0) { + if (!debug) + xmlDocDump(stdout, doc); + else + xmlDebugDumpDocument(stdout, doc); + } /* * free it. @@ -188,6 +192,9 @@ int main(int argc, char **argv) { else if ((!strcmp(argv[i], "-noent")) || (!strcmp(argv[i], "--noent"))) noent++; + else if ((!strcmp(argv[i], "-noout")) || + (!strcmp(argv[i], "--noout"))) + noout++; } if (noent != 0) xmlSubstituteEntitiesDefault(1); for (i = 1; i < argc ; i++) { @@ -197,13 +204,14 @@ int main(int argc, char **argv) { } } if (files == 0) { - printf("Usage : %s [--debug] [--copy] [--recover] [--noent] XMLfiles ...\n", + printf("Usage : %s [--debug] [--copy] [--recover] [--noent] [--noout] XMLfiles ...\n", argv[0]); printf("\tParse the XML files and output the result of the parsing\n"); printf("\t--debug : dump a debug tree of the in-memory document\n"); printf("\t--copy : used to test the internal copy implementation\n"); printf("\t--recover : output what is parsable on broken XmL documents\n"); printf("\t--noent : substitute entity references by their value\n"); + printf("\t--noout : don't output the result\n"); } return(0); diff --git a/tree.c b/tree.c index 873a73ff..86fd4ff7 100644 --- a/tree.c +++ b/tree.c @@ -417,7 +417,7 @@ xmlFreeDoc(xmlDocPtr cur) { #endif return; } - free((char *) cur->version); + if (cur->version != NULL) free((char *) cur->version); if (cur->name != NULL) free((char *) cur->name); if (cur->encoding != NULL) free((char *) cur->encoding); if (cur->root != NULL) xmlFreeNode(cur->root); @@ -2165,6 +2165,39 @@ xmlBufferFree(xmlBufferPtr buf) { free(buf); } +/** + * xmlBufferEmpty: + * @buf: the buffer + * + * empty a buffer. + */ +void +xmlBufferEmpty(xmlBufferPtr buf) { + buf->use = 0; + memset(buf->content, -1, buf->size);/* just for debug */ +} + +/** + * xmlBufferShrink: + * @buf: the buffer to dump + * @len: the number of CHAR to remove + * + * Remove the beginning of an XML buffer. + * + * Returns the number of CHAR removed, or -1 in case of failure. + */ +int +xmlBufferShrink(xmlBufferPtr buf, int len) { + if (len == 0) return(0); + if (len > buf->use) return(-1); + + buf->use -= len; + memmove(buf->content, &buf->content[len], buf->use * sizeof(CHAR)); + + buf->content[buf->use] = 0; + return(len); +} + /** * xmlBufferDump: * @file: the file output @@ -2200,26 +2233,32 @@ xmlBufferDump(FILE *file, xmlBufferPtr buf) { */ void xmlBufferAdd(xmlBufferPtr buf, const CHAR *str, int len) { - const CHAR *cur; + int l; if (str == NULL) { fprintf(stderr, "xmlBufferAdd: str == NULL\n"); return; } - for (cur = str;(len > 0) && (*cur != 0);cur++, len--) { - if (buf->use + 10 >= buf->size) { - CHAR *rebuf; + l = xmlStrlen(str); + if (l < len) len = l; + if (len <= 0) return; - buf->size *= 2; - rebuf = (CHAR *) realloc(buf->content, buf->size * sizeof(CHAR)); - if (rebuf == NULL) { - fprintf(stderr, "xmlBufferAdd : out of memory!\n"); - return; - } - buf->content = rebuf; + if (buf->use + len + 10 >= buf->size) { + CHAR *rebuf; + + buf->size *= 2; + if (buf->use + len + 10 > buf->size) + buf->size = buf->use + len + 10; + rebuf = (CHAR *) realloc(buf->content, buf->size * sizeof(CHAR)); + if (rebuf == NULL) { + fprintf(stderr, "xmlBufferAdd : out of memory!\n"); + return; } - buf->content[buf->use++] = *cur; + buf->content = rebuf; } + memmove(&buf->content[buf->use], str, len); + buf->use += len; + buf->content[buf->use] = 0; } /** diff --git a/tree.h b/tree.h index 0746c352..fddabb7e 100644 --- a/tree.h +++ b/tree.h @@ -269,6 +269,8 @@ int xmlBufferDump(FILE *file, xmlBufferPtr buf); void xmlBufferAdd(xmlBufferPtr buf, const CHAR *str, int len); void xmlBufferCat(xmlBufferPtr buf, const CHAR *str); void xmlBufferCCat(xmlBufferPtr buf, const char *str); +int xmlBufferShrink(xmlBufferPtr buf, int len); +void xmlBufferEmpty(xmlBufferPtr buf); /* * Creating/freeing new structures diff --git a/xmlIO.c b/xmlIO.c new file mode 100644 index 00000000..7df18eb3 --- /dev/null +++ b/xmlIO.c @@ -0,0 +1,321 @@ +/* + * xmlIO.c : implementation of the I/O interfaces used by the parser + * + * See Copyright for the status of this software. + * + * Daniel.Veillard@w3.org + */ + +#include "config.h" + +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_ZLIB_H +#include +#endif + +#include "xmlIO.h" + +/* #define DEBUG_INPUT */ +/* #define VERBOSE_FAILURE */ + +#ifdef DEBUG_INPUT +#define MINLEN 40 +#else +#define MINLEN 4000 +#endif + +/** + * xmlAllocParserInputBuffer: + * @enc: the charset encoding if known + * + * Create a buffered parser input for progressive parsing + * + * Returns the new parser input or NULL + */ +xmlParserInputBufferPtr +xmlAllocParserInputBuffer(xmlCharEncoding enc) { + xmlParserInputBufferPtr ret; + + ret = (xmlParserInputBufferPtr) malloc(sizeof(xmlParserInputBuffer)); + if (ret == NULL) { + fprintf(stderr, "xmlAllocParserInputBuffer : out of memory!\n"); + return(NULL); + } + memset(ret, 0, (size_t) sizeof(xmlParserInputBuffer)); + ret->buffer = xmlBufferCreate(); + ret->encoder = xmlGetCharEncodingHandler(enc); + ret->fd = -1; + + return(ret); +} + +/** + * xmlFreeParserInputBuffer: + * @in: a buffered parser input + * + * Free up the memory used by a buffered parser input + */ +void +xmlFreeParserInputBuffer(xmlParserInputBufferPtr in) { + if (in->buffer != NULL) { + xmlBufferFree(in->buffer); + in->buffer = NULL; + } +#ifdef HAVE_ZLIB_H + if (in->gzfile != NULL) + gzclose(in->gzfile); +#endif + if (in->fd >= 0) + close(in->fd); + memset(in, 0xbe, (size_t) sizeof(xmlParserInputBuffer)); + free(in); +} + +/** + * xmlParserInputBufferCreateFilename: + * @filename: a C string containing the filename + * @enc: the charset encoding if known + * + * Create a buffered parser input for the progressive parsing of a file + * If filename is "-' then we use stdin as the input. + * Automatic support for ZLIB/Compress compressed document is provided + * by default if found at compile-time. + * + * Returns the new parser input or NULL + */ +xmlParserInputBufferPtr +xmlParserInputBufferCreateFilename(const char *filename, xmlCharEncoding enc) { + xmlParserInputBufferPtr ret; +#ifdef HAVE_ZLIB_H + gzFile input; +#else + int input = -1; +#endif + + if (filename == NULL) return(NULL); + + if (!strcmp(filename, "-")) { +#ifdef HAVE_ZLIB_H + input = gzdopen (fileno(stdin), "r"); + if (input == NULL) { +#ifdef VERBOSE_FAILURE + fprintf (stderr, "Cannot read from stdin\n"); + perror ("gzdopen failed"); +#endif + return(NULL); + } +#else +#ifdef WIN32 + input = -1; +#else + input = fileno(stdin); +#endif + if (input < 0) { +#ifdef VERBOSE_FAILURE + fprintf (stderr, "Cannot read from stdin\n"); + perror ("open failed"); +#endif + return(NULL); + } +#endif + } else { +#ifdef HAVE_ZLIB_H + input = gzopen (filename, "r"); + if (input == NULL) { +#ifdef VERBOSE_FAILURE + fprintf (stderr, "Cannot read file %s :\n", filename); + perror ("gzopen failed"); +#endif + return(NULL); + } +#else +#ifdef WIN32 + input = _open (filename, O_RDONLY | _O_BINARY); +#else + input = open (filename, O_RDONLY); +#endif + if (input < 0) { +#ifdef VERBOSE_FAILURE + fprintf (stderr, "Cannot read file %s :\n", filename); + perror ("open failed"); +#endif + return(NULL); + } +#endif + } + /* + * TODO : get the 4 first bytes and + * if enc == XML_CHAR_ENCODING_NONE + * plug some encoding conversion routines here. !!! + * enc = xmlDetectCharEncoding(buffer); + */ + + ret = xmlAllocParserInputBuffer(enc); + if (ret != NULL) { +#ifdef HAVE_ZLIB_H + ret->gzfile = input; +#else + ret->fd = input; +#endif + } + xmlParserInputBufferRead(ret, 4); + + return(ret); +} + +/** + * xmlParserInputBufferCreateFile: + * @file: a FILE* + * @enc: the charset encoding if known + * + * Create a buffered parser input for the progressive parsing of a FILE * + * buffered C I/O + * + * Returns the new parser input or NULL + */ +xmlParserInputBufferPtr +xmlParserInputBufferCreateFile(FILE *file, xmlCharEncoding enc) { + xmlParserInputBufferPtr ret; + + if (file == NULL) return(NULL); + + ret = xmlAllocParserInputBuffer(enc); + if (ret != NULL) + ret->file = file; + + return(ret); +} + +/** + * xmlParserInputBufferCreateFd: + * @fd: a file descriptor number + * @enc: the charset encoding if known + * + * Create a buffered parser input for the progressive parsing for the input + * from a file descriptor + * + * Returns the new parser input or NULL + */ +xmlParserInputBufferPtr +xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc) { + xmlParserInputBufferPtr ret; + + if (fd < 0) return(NULL); + + ret = xmlAllocParserInputBuffer(enc); + if (ret != NULL) + ret->fd = fd; + + return(ret); +} + +/** + * xmlParserInputBufferGrow: + * @in: a buffered parser input + * @len: indicative value of the amount of chars to read + * + * Grow up the content of the input buffer, the old data are preserved + * This routine handle the I18N transcoding to internal UTF-8 + * TODO: one should be able to remove one copy + * + * Returns the number of chars read and stored in the buffer, or -1 + * in case of error. + */ +int +xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len) { + char *buffer = NULL; +#ifdef HAVE_ZLIB_H + gzFile input = (gzFile) in->gzfile; +#endif + int res = 0; + int nbchars = 0; + int buffree; + + if ((len <= MINLEN) && (len != 4)) + len = MINLEN; + buffree = in->buffer->size - in->buffer->use; + if (buffree <= 0) { + fprintf(stderr, "xmlParserInputBufferGrow : buffer full !\n"); + return(0); + } + if (len > buffree) + len = buffree; + + buffer = malloc((len + 1) * sizeof(char)); + if (buffer == NULL) { + fprintf(stderr, "xmlParserInputBufferGrow : out of memory !\n"); + return(-1); + } + if (in->file != NULL) { + res = fread(&buffer[0], 1, len, in->file); +#ifdef HAVE_ZLIB_H + } else if (in->gzfile != NULL) { + res = gzread(input, &buffer[0], len); +#endif + } else if (in->fd >= 0) { + res = read(in->fd, &buffer[0], len); + } else { + fprintf(stderr, "xmlParserInputBufferGrow : no input !\n"); + free(buffer); + return(-1); + } + if (res == 0) { + free(buffer); + return(0); + } + if (res < 0) { + perror ("read error"); + free(buffer); + return(-1); + } + if (in->encoder != NULL) { + CHAR *buf; + + buf = (CHAR *) malloc((res + 1) * 2 * sizeof(CHAR)); + if (buf == NULL) { + fprintf(stderr, "xmlParserInputBufferGrow : out of memory !\n"); + free(buffer); + return(-1); + } + nbchars = in->encoder->input(buf, (res + 1) * 2 * sizeof(CHAR), + buffer, res); + buf[nbchars] = 0; + xmlBufferAdd(in->buffer, (CHAR *) buf, nbchars); + free(buf); + } else { + nbchars = res; + buffer[nbchars] = 0; + xmlBufferAdd(in->buffer, (CHAR *) buffer, nbchars); + } +#ifdef DEBUG_INPUT + fprintf(stderr, "I/O: read %d chars, buffer %d/%d\n", + nbchars, in->buffer->use, in->buffer->size); +#endif + free(buffer); + return(nbchars); +} + +/** + * xmlParserInputBufferRead: + * @in: a buffered parser input + * @len: indicative value of the amount of chars to read + * + * Refresh the content of the input buffer, the old data are considered + * consumed + * This routine handle the I18N transcoding to internal UTF-8 + * + * Returns the number of chars read and stored in the buffer, or -1 + * in case of error. + */ +int +xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len) { + /* xmlBufferEmpty(in->buffer); */ + return(xmlParserInputBufferGrow(in, len)); +} + diff --git a/xmlIO.h b/xmlIO.h index d6edcae2..bdeecc3f 100644 --- a/xmlIO.h +++ b/xmlIO.h @@ -11,6 +11,7 @@ #include #include "tree.h" +#include "encoding.h" #ifdef __cplusplus extern "C" { @@ -19,13 +20,10 @@ extern "C" { typedef struct xmlParserInputBuffer { /* Inputs */ FILE *file; /* Input on file handler */ + void* gzfile; /* Input on a compressed stream */ int fd; /* Input on a file descriptor */ -/********** -#ifdef HAVE_ZLIB_H - gzFile gzfile; Input on a compressed stream -#endif - */ + xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */ xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */ @@ -33,6 +31,21 @@ typedef struct xmlParserInputBuffer { typedef xmlParserInputBuffer *xmlParserInputBufferPtr; +/* + * Interfaces + */ + +xmlParserInputBufferPtr xmlParserInputBufferCreateFilename(const char *filename, + xmlCharEncoding enc); +xmlParserInputBufferPtr xmlParserInputBufferCreateFile(FILE *file, + xmlCharEncoding enc); +xmlParserInputBufferPtr xmlParserInputBufferCreateFd(int fd, xmlCharEncoding enc); + +int xmlParserInputBufferRead(xmlParserInputBufferPtr in, int len); +int xmlParserInputBufferGrow(xmlParserInputBufferPtr in, int len); + +void xmlFreeParserInputBuffer(xmlParserInputBufferPtr in); + #ifdef __cplusplus } #endif diff --git a/xpath.c b/xpath.c index d6c8f7e5..33c13f04 100644 --- a/xpath.c +++ b/xpath.c @@ -25,11 +25,34 @@ * actual root. */ /* - * That sucks but I couldn't find NAN on a PeeCee Linux Glibc 2.1 + * Setup stuff for floating point */ -#ifndef NAN -#define NAN 12345679 -#endif +double xmlXPathNAN = 0; +double xmlXPathPINF = 1; +double xmlXPathMINF = -1; + +/** + * xmlXPathInit: + * + * Initialize the XPath environment + */ +void +xmlXPathInit(void) { + static int initialized = 0; + + if (initialized) return; + + xmlXPathNAN = 0; + xmlXPathNAN /= 0; + + xmlXPathPINF = 1; + xmlXPathPINF /= 0; + + xmlXPathMINF = -1; + xmlXPathMINF /= 0; + + initialized = 1; +} /* #define DEBUG */ /* #define DEBUG_STEP */ @@ -45,7 +68,7 @@ FILE *xmlXPathDebug = NULL; fprintf(xmlXPathDebug, "Internal error at %s:%d\n", \ __FILE__, __LINE__); -float xmlXPathStringEvalNumber(const CHAR *str); +double xmlXPathStringEvalNumber(const CHAR *str); /************************************************************************ * * @@ -167,7 +190,7 @@ const char *xmlXPathErrorMessages[] = { * @line: the line number * @no: the error number * - * Create a new xmlNodeSetPtr of type float and of value @val + * Create a new xmlNodeSetPtr of type double and of value @val * * Returns the newly created object. */ @@ -231,7 +254,7 @@ xmlXPatherror(xmlXPathParserContextPtr ctxt, const char *file, * xmlXPathNodeSetCreate: * @val: an initial xmlNodePtr, or NULL * - * Create a new xmlNodeSetPtr of type float and of value @val + * Create a new xmlNodeSetPtr of type double and of value @val * * Returns the newly created object. */ @@ -244,7 +267,7 @@ xmlXPathNodeSetCreate(xmlNodePtr val) { fprintf(xmlXPathDebug, "xmlXPathNewNodeSet: out of memory\n"); return(NULL); } - memset(ret, 0 , sizeof(xmlNodeSet)); + memset(ret, 0 , (size_t) sizeof(xmlNodeSet)); if (val != NULL) { ret->nodeTab = (xmlNodePtr *) malloc(XML_NODESET_DEFAULT * sizeof(xmlNodePtr)); @@ -253,7 +276,7 @@ xmlXPathNodeSetCreate(xmlNodePtr val) { return(NULL); } memset(ret->nodeTab, 0 , - XML_NODESET_DEFAULT * sizeof(xmlNodePtr)); + XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr)); ret->nodeMax = XML_NODESET_DEFAULT; ret->nodeTab[ret->nodeNr++] = val; } @@ -290,7 +313,7 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) { return; } memset(cur->nodeTab, 0 , - XML_NODESET_DEFAULT * sizeof(xmlNodePtr)); + XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr)); cur->nodeMax = XML_NODESET_DEFAULT; } else if (cur->nodeNr == cur->nodeMax) { xmlNodePtr *temp; @@ -395,12 +418,12 @@ xmlXPathFreeNodeSet(xmlNodeSetPtr obj) { if (obj == NULL) return; if (obj->nodeTab != NULL) { #ifdef DEBUG - memset(obj->nodeTab, 0xB , sizeof(xmlNodePtr) * obj->nodeMax); + memset(obj->nodeTab, 0xB , (size_t) sizeof(xmlNodePtr) * obj->nodeMax); #endif free(obj->nodeTab); } #ifdef DEBUG - memset(obj, 0xB , sizeof(xmlNodeSet)); + memset(obj, 0xB , (size_t) sizeof(xmlNodeSet)); #endif free(obj); } @@ -480,14 +503,14 @@ xmlXPathVariablelookup(xmlXPathParserContextPtr ctxt, /** * xmlXPathNewFloat: - * @val: the float value + * @val: the double value * - * Create a new xmlXPathObjectPtr of type float and of value @val + * Create a new xmlXPathObjectPtr of type double and of value @val * * Returns the newly created object. */ xmlXPathObjectPtr -xmlXPathNewFloat(float val) { +xmlXPathNewFloat(double val) { xmlXPathObjectPtr ret; ret = (xmlXPathObjectPtr) malloc(sizeof(xmlXPathObject)); @@ -495,7 +518,7 @@ xmlXPathNewFloat(float val) { fprintf(xmlXPathDebug, "xmlXPathNewFloat: out of memory\n"); return(NULL); } - memset(ret, 0 , sizeof(xmlXPathObject)); + memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); ret->type = XPATH_NUMBER; ret->floatval = val; return(ret); @@ -518,33 +541,12 @@ xmlXPathNewBoolean(int val) { fprintf(xmlXPathDebug, "xmlXPathNewFloat: out of memory\n"); return(NULL); } - memset(ret, 0 , sizeof(xmlXPathObject)); + memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); ret->type = XPATH_BOOLEAN; ret->boolval = (val != 0); return(ret); } -/** - * xmlXPathNewMarker: - * - * Create a new xmlXPathObjectPtr of a special marker type for functions - * - * Returns the newly created object. - */ -xmlXPathObjectPtr -xmlXPathNewMarker(void) { - xmlXPathObjectPtr ret; - - ret = (xmlXPathObjectPtr) malloc(sizeof(xmlXPathObject)); - if (ret == NULL) { - fprintf(xmlXPathDebug, "xmlXPathNewFloat: out of memory\n"); - return(NULL); - } - memset(ret, 0 , sizeof(xmlXPathObject)); - ret->type = XPATH_MARKER; - return(ret); -} - /** * xmlXPathNewBoolean: * @val: the CHAR * value @@ -562,7 +564,7 @@ xmlXPathNewString(const CHAR *val) { fprintf(xmlXPathDebug, "xmlXPathNewFloat: out of memory\n"); return(NULL); } - memset(ret, 0 , sizeof(xmlXPathObject)); + memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); ret->type = XPATH_STRING; ret->stringval = xmlStrdup(val); return(ret); @@ -586,7 +588,7 @@ xmlXPathNewNodeSet(xmlNodePtr val) { fprintf(xmlXPathDebug, "xmlXPathNewFloat: out of memory\n"); return(NULL); } - memset(ret, 0 , sizeof(xmlXPathObject)); + memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); ret->type = XPATH_NODESET; ret->nodesetval = xmlXPathNodeSetCreate(val); return(ret); @@ -610,7 +612,7 @@ xmlXPathNewNodeSetList(xmlNodeSetPtr val) { fprintf(xmlXPathDebug, "xmlXPathNewFloat: out of memory\n"); return(NULL); } - memset(ret, 0 , sizeof(xmlXPathObject)); + memset(ret, 0 , (size_t) sizeof(xmlXPathObject)); ret->type = XPATH_NODESET; ret->nodesetval = val; return(ret); @@ -630,7 +632,7 @@ xmlXPathFreeObject(xmlXPathObjectPtr obj) { if (obj->stringval != NULL) free(obj->stringval); #ifdef DEBUG - memset(obj, 0xB , sizeof(xmlXPathObject)); + memset(obj, 0xB , (size_t) sizeof(xmlXPathObject)); #endif free(obj); } @@ -662,7 +664,7 @@ xmlXPathNewContext(xmlDocPtr doc, void *variables, void *functions, fprintf(xmlXPathDebug, "xmlXPathNewContext: out of memory\n"); return(NULL); } - memset(ret, 0 , sizeof(xmlXPathContext)); + memset(ret, 0 , (size_t) sizeof(xmlXPathContext)); ret->doc = doc; ret->variables = variables; ret->functions = functions; @@ -679,7 +681,7 @@ xmlXPathNewContext(xmlDocPtr doc, void *variables, void *functions, void xmlXPathFreeContext(xmlXPathContextPtr ctxt) { #ifdef DEBUG - memset(ctxt, 0xB , sizeof(xmlXPathContext)); + memset(ctxt, 0xB , (size_t) sizeof(xmlXPathContext)); #endif free(ctxt); } @@ -731,7 +733,7 @@ xmlXPathNewParserContext(const CHAR *str, xmlXPathContextPtr ctxt) { fprintf(xmlXPathDebug, "xmlXPathNewParserContext: out of memory\n"); return(NULL); } - memset(ret, 0 , sizeof(xmlXPathParserContext)); + memset(ret, 0 , (size_t) sizeof(xmlXPathParserContext)); ret->cur = ret->base = str; ret->context = ctxt; @@ -754,12 +756,12 @@ void xmlXPathFreeParserContext(xmlXPathParserContextPtr ctxt) { if (ctxt->valueTab != NULL) { #ifdef DEBUG - memset(ctxt->valueTab, 0xB , 10 * sizeof(xmlXPathObjectPtr)); + memset(ctxt->valueTab, 0xB , 10 * (size_t) sizeof(xmlXPathObjectPtr)); #endif free(ctxt->valueTab); } #ifdef DEBUG - memset(ctxt, 0xB , sizeof(xmlXPathParserContext)); + memset(ctxt, 0xB , (size_t) sizeof(xmlXPathParserContext)); #endif free(ctxt); } @@ -794,7 +796,7 @@ void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs); } \ if (arg->type != XPATH_NUMBER) { \ valuePush(ctxt, arg); \ - xmlXPathNumberFunction(ctxt, 1); \ + xmlXPathNumberFunction(ctxt, 1); \ arg = valuePop(ctxt); \ } @@ -903,14 +905,14 @@ xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt) { * xmlXPathAddValues: * @ctxt: the XPath Parser context * - * Implement the add operation on XPath objects: @arg1 + @arg2 + * Implement the add operation on XPath objects: * The numeric operators convert their operands to numbers as if * by calling the number function. */ void xmlXPathAddValues(xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr arg; - float val; + double val; POP_FLOAT val = arg->floatval; @@ -925,14 +927,14 @@ xmlXPathAddValues(xmlXPathParserContextPtr ctxt) { * xmlXPathSubValues: * @ctxt: the XPath Parser context * - * Implement the substraction operation on XPath objects: @arg1 - @arg2 + * Implement the substraction operation on XPath objects: * The numeric operators convert their operands to numbers as if * by calling the number function. */ void xmlXPathSubValues(xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr arg; - float val; + double val; POP_FLOAT val = arg->floatval; @@ -947,14 +949,14 @@ xmlXPathSubValues(xmlXPathParserContextPtr ctxt) { * xmlXPathMultValues: * @ctxt: the XPath Parser context * - * Implement the multiply operation on XPath objects: @arg1 * @arg2 + * Implement the multiply operation on XPath objects: * The numeric operators convert their operands to numbers as if * by calling the number function. */ void xmlXPathMultValues(xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr arg; - float val; + double val; POP_FLOAT val = arg->floatval; @@ -969,14 +971,14 @@ xmlXPathMultValues(xmlXPathParserContextPtr ctxt) { * xmlXPathDivValues: * @ctxt: the XPath Parser context * - * Implement the div operation on XPath objects: @arg1 / @arg2 + * Implement the div operation on XPath objects: * The numeric operators convert their operands to numbers as if * by calling the number function. */ void xmlXPathDivValues(xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr arg; - float val; + double val; POP_FLOAT val = arg->floatval; @@ -998,7 +1000,7 @@ xmlXPathDivValues(xmlXPathParserContextPtr ctxt) { void xmlXPathModValues(xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr arg; - float val; + double val; POP_FLOAT val = arg->floatval; @@ -1590,10 +1592,10 @@ xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs) { if ((ctxt->context->nodelist == NULL) || (ctxt->context->node == NULL) || (ctxt->context->nodelist->nodeNr == 0)) { - valuePush(ctxt, xmlXPathNewFloat((float) 0)); + valuePush(ctxt, xmlXPathNewFloat((double) 0)); } else { valuePush(ctxt, - xmlXPathNewFloat((float) ctxt->context->nodelist->nodeNr)); + xmlXPathNewFloat((double) ctxt->context->nodelist->nodeNr)); } } @@ -1614,15 +1616,15 @@ xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs) { if ((ctxt->context->nodelist == NULL) || (ctxt->context->node == NULL) || (ctxt->context->nodelist->nodeNr == 0)) { - valuePush(ctxt, xmlXPathNewFloat((float) 0)); + valuePush(ctxt, xmlXPathNewFloat((double) 0)); } for (i = 0; i < ctxt->context->nodelist->nodeNr;i++) { if (ctxt->context->node == ctxt->context->nodelist->nodeTab[i]) { - valuePush(ctxt, xmlXPathNewFloat((float) i + 1)); + valuePush(ctxt, xmlXPathNewFloat((double) i + 1)); return; } } - valuePush(ctxt, xmlXPathNewFloat((float) 0)); + valuePush(ctxt, xmlXPathNewFloat((double) 0)); } /** @@ -1639,7 +1641,7 @@ xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs) { CHECK_TYPE(XPATH_NODESET); cur = valuePop(ctxt); - valuePush(ctxt, xmlXPathNewFloat((float) cur->nodesetval->nodeNr)); + valuePush(ctxt, xmlXPathNewFloat((double) cur->nodesetval->nodeNr)); xmlXPathFreeObject(cur); } @@ -1835,9 +1837,16 @@ xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs) { case XPATH_NUMBER: { CHAR buf[100]; - /* NAN, infinity, etc .... !!!!!! */ - sprintf(buf, "%0g", cur->floatval); + if (isnan(cur->floatval)) + sprintf(buf, "NaN"); + else if (isinf(cur->floatval) > 0) + sprintf(buf, "+Infinity"); + else if (isinf(cur->floatval) < 0) + sprintf(buf, "-Infinity"); + else + sprintf(buf, "%0g", cur->floatval); valuePush(ctxt, xmlXPathNewString(buf)); + xmlXPathFreeObject(cur); return; } } @@ -2006,7 +2015,7 @@ xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs) { void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr str, start, len; - float le, in; + double le, in; int i, l; CHAR *ret; @@ -2037,11 +2046,11 @@ xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs) { /* integer index of the first char */ i = in; - if (((float)i) != in) i++; + if (((double)i) != in) i++; /* integer index of the last char */ l = le; - if (((float)l) != le) l++; + if (((double)l) != le) l++; /* back to a zero based len */ i--; @@ -2061,8 +2070,10 @@ xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs) { ret = xmlStrsub(str->stringval, i, l); if (ret == NULL) valuePush(ctxt, xmlXPathNewString("")); - else + else { valuePush(ctxt, xmlXPathNewString(ret)); + free(ret); + } xmlXPathFreeObject(str); } @@ -2262,7 +2273,7 @@ xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs) { void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur; - float res; + double res; CHECK_ARITY(1); cur = valuePop(ctxt); @@ -2315,7 +2326,7 @@ xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs) { CHECK_ARITY(1); CHECK_TYPE(XPATH_NUMBER); /* floor(0.999999999999) => 1.0 !!!!!!!!!!! */ - ctxt->value->floatval = (float)((int) ctxt->value->floatval); + ctxt->value->floatval = (double)((int) ctxt->value->floatval); } /** @@ -2328,11 +2339,11 @@ xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs) { */ void xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs) { - float f; + double f; CHECK_ARITY(1); CHECK_TYPE(XPATH_NUMBER); - f = (float)((int) ctxt->value->floatval); + f = (double)((int) ctxt->value->floatval); if (f != ctxt->value->floatval) ctxt->value->floatval = f + 1; } @@ -2348,12 +2359,12 @@ xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs) { */ void xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs) { - float f; + double f; CHECK_ARITY(1); CHECK_TYPE(XPATH_NUMBER); /* round(0.50000001) => 0 !!!!! */ - f = (float)((int) ctxt->value->floatval); + f = (double)((int) ctxt->value->floatval); if (ctxt->value->floatval < f + 0.5) ctxt->value->floatval = f; else if (ctxt->value->floatval == f + 0.5) @@ -2455,18 +2466,18 @@ xmlXPathParseQName(xmlXPathParserContextPtr ctxt, CHAR **prefix) { * BUG: "1.' is not valid ... James promised correction * as Digits ('.' Digits?)? * - * Returns the float value. + * Returns the double value. */ -float +double xmlXPathStringEvalNumber(const CHAR *str) { const CHAR *cur = str; - float ret = 0.0; - float mult = 1; + double ret = 0.0; + double mult = 1; int ok = 0; while (*cur == ' ') cur++; if ((*cur != '.') && ((*cur < '0') || (*cur > '9'))) { - return(NAN); + return(xmlXPathNAN); } while ((*cur >= '0') && (*cur <= '9')) { ret = ret * 10 + (*cur - '0'); @@ -2476,7 +2487,7 @@ xmlXPathStringEvalNumber(const CHAR *str) { if (*cur == '.') { cur++; if (((*cur < '0') || (*cur > '9')) && (!ok)) { - return(NAN); + return(xmlXPathNAN); } while ((*cur >= '0') && (*cur <= '9')) { mult /= 10; @@ -2485,7 +2496,7 @@ xmlXPathStringEvalNumber(const CHAR *str) { } } while (*cur == ' ') cur++; - if (*cur != 0) return(NAN); + if (*cur != 0) return(xmlXPathNAN); return(ret); } @@ -2504,8 +2515,8 @@ xmlXPathStringEvalNumber(const CHAR *str) { */ void xmlXPathEvalNumber(xmlXPathParserContextPtr ctxt) { - float ret = 0.0; - float mult = 1; + double ret = 0.0; + double mult = 1; int ok = 0; CHECK_ERROR; @@ -2801,6 +2812,7 @@ xmlXPathEvalFunctionCall(xmlXPathParserContextPtr ctxt) { } func = xmlXPathIsFunction(ctxt, name); if (func == NULL) { + free(name); ERROR(XPATH_UNKNOWN_FUNC_ERROR); } #ifdef DEBUG_EXPR @@ -2808,21 +2820,23 @@ xmlXPathEvalFunctionCall(xmlXPathParserContextPtr ctxt) { #endif if (CUR != '(') { + free(name); ERROR(XPATH_EXPR_ERROR); } NEXT; - valuePush(ctxt, xmlXPathNewMarker()); while (CUR != ')') { xmlXPathEvalExpr(ctxt); nbargs++; if (CUR == ')') break; if (CUR != ',') { + free(name); ERROR(XPATH_EXPR_ERROR); } NEXT; } NEXT; + free(name); func(ctxt, nbargs); } @@ -3443,6 +3457,8 @@ xmlXPathEvalBasis(xmlXPathParserContextPtr ctxt) { NEXT; nodetest = NODE_TEST_ALL; } else { + if (name != NULL) + free(name); name = xmlXPathParseQName(ctxt, &prefix); nodetest = NODE_TEST_NAME; } @@ -3473,6 +3489,8 @@ search_nodes: fprintf(xmlXPathDebug, "Basis : "); xmlXPathDebugNodeSet(stdout, ctxt->context->nodelist); #endif + if (name != NULL) free(name); + if (prefix != NULL) free(prefix); } /** @@ -3647,6 +3665,8 @@ xmlXPathEval(const CHAR *str, xmlXPathContextPtr ctxt) { xmlXPathParserContextPtr pctxt; xmlXPathObjectPtr res; + xmlXPathInit(); + CHECK_CONTEXT if (xmlXPathDebug == NULL) @@ -3679,6 +3699,8 @@ xmlXPathEvalExpression(const CHAR *str, xmlXPathContextPtr ctxt) { xmlXPathParserContextPtr pctxt; xmlXPathObjectPtr res, tmp; + xmlXPathInit(); + CHECK_CONTEXT if (xmlXPathDebug == NULL) @@ -3689,8 +3711,8 @@ xmlXPathEvalExpression(const CHAR *str, xmlXPathContextPtr ctxt) { res = valuePop(pctxt); do { tmp = valuePop(pctxt); -#ifdef DEBUG -#endif + if (tmp != NULL); + xmlXPathFreeObject(tmp); } while (tmp != NULL); xmlXPathFreeParserContext(pctxt); return(res); diff --git a/xpath.h b/xpath.h index fb06e233..737b55c1 100644 --- a/xpath.h +++ b/xpath.h @@ -37,13 +37,12 @@ typedef struct xmlNodeSet { #define XPATH_BOOLEAN 2 #define XPATH_NUMBER 3 #define XPATH_STRING 4 -#define XPATH_MARKER 5 /* used for func call checks */ typedef struct xmlXPathObject { int type; xmlNodeSetPtr nodesetval; int boolval; - float floatval; + double floatval; CHAR *stringval; } xmlXPathObject, *xmlXPathObjectPtr;