diff --git a/ChangeLog b/ChangeLog index 71c53a13..ac1693d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Dec 31 17:35:40 CET 2001 Daniel Veillard + + * DOCBparser.c parser.c valid.c include/libxml/parserInternals.h + include/libxml/xmlerror.h include/libxml/xpathInternals.h: + Fixed a few other problems raised by Charlie Bozeman. + * result/VC/ElementValid[5-7]: fixed the output + Mon Dec 31 17:13:34 CET 2001 Daniel Veillard * *.c include/libxml/*.h doc/html/*: applied 42 documentation diff --git a/DOCBparser.c b/DOCBparser.c index bcfeb3d5..aec90f03 100644 --- a/DOCBparser.c +++ b/DOCBparser.c @@ -1057,72 +1057,6 @@ docbAutoCloseTag(docbDocPtr doc, const xmlChar *name, docbNodePtr elem) { return(0); } -#if 0 -/** - * docbIsAutoClosed: - * @doc: the SGML document - * @elem: the SGML element - * - * The list is kept in docbStartClose array. This function checks - * if a tag is autoclosed by one of it's child - * - * Returns 1 if autoclosed, 0 otherwise - */ -static int -docbIsAutoClosed(docbDocPtr doc, docbNodePtr elem) { - docbNodePtr child; - - if (elem == NULL) return(1); - child = elem->children; - while (child != NULL) { - if (docbAutoCloseTag(doc, elem->name, child)) return(1); - child = child->next; - } - return(0); -} -#endif - -/** - * docbCheckParagraph - * @ctxt: an SGML parser context - * - * Check whether a p element need to be implied before inserting - * characters in the current element. - * - * Returns 1 if a paragraph has been inserted, 0 if not and -1 - * in case of error. - */ - -static int -docbCheckParagraph(docbParserCtxtPtr ctxt) { - const xmlChar *tag; - int i; - - if (ctxt == NULL) - return(-1); - tag = ctxt->name; - if (tag == NULL) { - docbAutoClose(ctxt, BAD_CAST"p"); - docbnamePush(ctxt, xmlStrdup(BAD_CAST"p")); - if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) - ctxt->sax->startElement(ctxt->userData, BAD_CAST"p", NULL); - return(1); - } - for (i = 0; docbNoContentElements[i] != NULL; i++) { - if (xmlStrEqual(tag, BAD_CAST docbNoContentElements[i])) { -#ifdef DEBUG - xmlGenericError(xmlGenericErrorContext,"Implied element paragraph\n"); -#endif - docbAutoClose(ctxt, BAD_CAST"p"); - docbnamePush(ctxt, xmlStrdup(BAD_CAST"p")); - if ((ctxt->sax != NULL) && (ctxt->sax->startElement != NULL)) - ctxt->sax->startElement(ctxt->userData, BAD_CAST"p", NULL); - return(1); - } - } - return(0); -} - /************************************************************************ * * * The list of SGML predefined entities * @@ -3105,7 +3039,6 @@ docbParseCharData(docbParserCtxtPtr ctxt) { ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar); } else { - docbCheckParagraph(ctxt); if (ctxt->sax->characters != NULL) ctxt->sax->characters(ctxt->userData, buf, nbchar); } @@ -3124,7 +3057,6 @@ docbParseCharData(docbParserCtxtPtr ctxt) { if (ctxt->sax->ignorableWhitespace != NULL) ctxt->sax->ignorableWhitespace(ctxt->userData, buf, nbchar); } else { - docbCheckParagraph(ctxt); if (ctxt->sax->characters != NULL) ctxt->sax->characters(ctxt->userData, buf, nbchar); } @@ -4051,7 +3983,6 @@ docbParseReference(docbParserCtxtPtr ctxt) { } out[i] = 0; - docbCheckParagraph(ctxt); if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) ctxt->sax->characters(ctxt->userData, out, i); } else { @@ -4102,7 +4033,6 @@ docbParseReference(docbParserCtxtPtr ctxt) { } else if (name != NULL) { ent = docbEntityLookup(name); if ((ent == NULL) || (ent->value <= 0)) { - docbCheckParagraph(ctxt); if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) { ctxt->sax->characters(ctxt->userData, BAD_CAST "&", 1); ctxt->sax->characters(ctxt->userData, name, xmlStrlen(name)); @@ -4127,12 +4057,10 @@ docbParseReference(docbParserCtxtPtr ctxt) { } out[i] = 0; - docbCheckParagraph(ctxt); if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) ctxt->sax->characters(ctxt->userData, out, i); } } else { - docbCheckParagraph(ctxt); if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) ctxt->sax->characters(ctxt->userData, BAD_CAST "&", 1); return; @@ -5607,7 +5535,6 @@ docbParseTryOrFinish(docbParserCtxtPtr ctxt, int terminate) { xmlChar chr[2] = { 0 , 0 } ; chr[0] = (xmlChar) ctxt->token; - docbCheckParagraph(ctxt); if ((ctxt->sax != NULL) && (ctxt->sax->characters != NULL)) ctxt->sax->characters(ctxt->userData, chr, 1); ctxt->token = 0; @@ -5622,7 +5549,6 @@ docbParseTryOrFinish(docbParserCtxtPtr ctxt, int terminate) { ctxt->sax->ignorableWhitespace( ctxt->userData, &cur, 1); } else { - docbCheckParagraph(ctxt); if (ctxt->sax->characters != NULL) ctxt->sax->characters( ctxt->userData, &cur, 1); diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h index 491d749b..490f9f6b 100644 --- a/include/libxml/parserInternals.h +++ b/include/libxml/parserInternals.h @@ -197,7 +197,6 @@ int xmlIsChar (int c); /** * Parser context */ -xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur); xmlParserCtxtPtr xmlCreateFileParserCtxt (const char *filename); xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer, int size); diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h index 6a69512d..94fc3723 100644 --- a/include/libxml/xmlerror.h +++ b/include/libxml/xmlerror.h @@ -110,7 +110,7 @@ typedef enum { XML_ERR_EQUAL_REQUIRED, XML_ERR_TAG_NAME_MISMATCH, /* 77 */ - XML_ERR_TAG_NOT_FINISED, + XML_ERR_TAG_NOT_FINISHED, XML_ERR_STANDALONE_VALUE, /* 79 */ diff --git a/include/libxml/xpathInternals.h b/include/libxml/xpathInternals.h index ed39e365..ccbf53fe 100644 --- a/include/libxml/xpathInternals.h +++ b/include/libxml/xpathInternals.h @@ -177,7 +177,7 @@ void * xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); * * Pushes an empty node-set on the context stack */ -#define xmlXPathReturnEmptyNodeSet(ctxt, ns) \ +#define xmlXPathReturnEmptyNodeSet(ctxt) \ valuePush((ctxt), xmlXPathNewNodeSet(NULL)) /** diff --git a/parser.c b/parser.c index 870cafb6..08d18ee0 100644 --- a/parser.c +++ b/parser.c @@ -6848,7 +6848,7 @@ xmlParseElement(xmlParserCtxtPtr ctxt) { */ xmlParseContent(ctxt); if (!IS_CHAR(RAW)) { - ctxt->errNo = XML_ERR_TAG_NOT_FINISED; + ctxt->errNo = XML_ERR_TAG_NOT_FINISHED; if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) ctxt->sax->error(ctxt->userData, "Premature end of data in tag %.30s\n", openTag); diff --git a/result/VC/ElementValid5 b/result/VC/ElementValid5 index b4dd280e..1aecfb7a 100644 --- a/result/VC/ElementValid5 +++ b/result/VC/ElementValid5 @@ -1,4 +1,4 @@ -./test/VC/ElementValid5:7: validity error: Element doc content doesn't follow the Dtd +./test/VC/ElementValid5:7: validity error: Element doc content doesn't follow the DTD Expecting (a , b* , c+), got (a b c b) but thiswas not declaredseems ^ diff --git a/result/VC/ElementValid6 b/result/VC/ElementValid6 index 67967b2e..bf63d479 100644 --- a/result/VC/ElementValid6 +++ b/result/VC/ElementValid6 @@ -1,4 +1,4 @@ -./test/VC/ElementValid6:7: validity error: Element doc content doesn't follow the Dtd +./test/VC/ElementValid6:7: validity error: Element doc content doesn't follow the DTD Expecting (a , b? , c+)?, got (a b) lacks c ^ diff --git a/result/VC/ElementValid7 b/result/VC/ElementValid7 index a5727c29..de60754a 100644 --- a/result/VC/ElementValid7 +++ b/result/VC/ElementValid7 @@ -1,4 +1,4 @@ -./test/VC/ElementValid7:7: validity error: Element doc content doesn't follow the Dtd +./test/VC/ElementValid7:7: validity error: Element doc content doesn't follow the DTD Expecting ((a | b)* , c+ , a , b? , c , a?), got (a b a c c a) ^ diff --git a/valid.c b/valid.c index 0ee4c330..24ce16aa 100644 --- a/valid.c +++ b/valid.c @@ -97,11 +97,11 @@ typedef struct _xmlValidState { #define OCCURS ctxt->vstate->occurs #define STATE ctxt->vstate->state -#define OCCURENCE (ctxt->vstate->occurs & (1 << DEPTH)) -#define PARENT_OCCURENCE (ctxt->vstate->occurs & ((1 << DEPTH) - 1)) +#define OCCURRENCE (ctxt->vstate->occurs & (1 << DEPTH)) +#define PARENT_OCCURRENCE (ctxt->vstate->occurs & ((1 << DEPTH) - 1)) -#define SET_OCCURENCE ctxt->vstate->occurs |= (1 << DEPTH) -#define RESET_OCCURENCE ctxt->vstate->occurs &= ((1 << DEPTH) - 1) +#define SET_OCCURRENCE ctxt->vstate->occurs |= (1 << DEPTH) +#define RESET_OCCURRENCE ctxt->vstate->occurs &= ((1 << DEPTH) - 1) static int vstateVPush(xmlValidCtxtPtr ctxt, xmlElementContentPtr cont, @@ -3445,7 +3445,7 @@ cont: (CONT->parent->type != XML_ELEMENT_CONTENT_OR)) && ((CONT->ocur == XML_ELEMENT_CONTENT_MULT) || (CONT->ocur == XML_ELEMENT_CONTENT_OPT) || - ((CONT->ocur == XML_ELEMENT_CONTENT_PLUS) && (OCCURENCE)))) { + ((CONT->ocur == XML_ELEMENT_CONTENT_PLUS) && (OCCURRENCE)))) { DEBUG_VALID_MSG("saving parent branch"); vstateVPush(ctxt, CONT, NODE, DEPTH, OCCURS, ROLLBACK_PARENT); } @@ -3616,7 +3616,7 @@ analyze: determinist = -3; goto cont; case XML_ELEMENT_CONTENT_PLUS: - if (OCCURENCE == 0) { + if (OCCURRENCE == 0) { cur = ctxt->vstate->node; DEBUG_VALID_MSG("Plus branch failed, rollback"); if (vstateVPop(ctxt) < 0 ) { @@ -3632,7 +3632,7 @@ analyze: break; case XML_ELEMENT_CONTENT_MULT: #ifdef DEBUG_VALID_ALGO - if (OCCURENCE == 0) { + if (OCCURRENCE == 0) { DEBUG_VALID_MSG("Mult branch failed"); } else { DEBUG_VALID_MSG("Mult branch found"); @@ -3667,7 +3667,7 @@ analyze: break; } DEBUG_VALID_MSG("Plus branch succeeded, continuing"); - SET_OCCURENCE; + SET_OCCURRENCE; goto cont; case XML_ELEMENT_CONTENT_MULT: if (STATE == ROLLBACK_PARENT) { @@ -3681,7 +3681,7 @@ analyze: break; } DEBUG_VALID_MSG("Mult branch succeeded, continuing"); - /* SET_OCCURENCE; */ + /* SET_OCCURRENCE; */ goto cont; } } @@ -3690,7 +3690,7 @@ analyze: /* * Then act accordingly at the parent level */ - RESET_OCCURENCE; + RESET_OCCURRENCE; if (CONT->parent == NULL) break;