Fixed a few other problems raised by Charlie Bozeman. fixed the output

* 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
Daniel
diff --git a/ChangeLog b/ChangeLog
index 71c53a1..ac1693d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Dec 31 17:35:40 CET 2001 Daniel Veillard <daniel@veillard.com>
+
+	* 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 <daniel@veillard.com>
 
 	* *.c include/libxml/*.h doc/html/*: applied 42 documentation
diff --git a/DOCBparser.c b/DOCBparser.c
index bcfeb3d..aec90f0 100644
--- a/DOCBparser.c
+++ b/DOCBparser.c
@@ -1057,72 +1057,6 @@
     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 @@
                        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 @@
                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 @@
         }
        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 @@
        } 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 @@
 	       }
 	       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 @@
                    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 @@
                                    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 491d749..490f9f6 100644
--- a/include/libxml/parserInternals.h
+++ b/include/libxml/parserInternals.h
@@ -197,7 +197,6 @@
 /**
  * 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 6a69512..94fc372 100644
--- a/include/libxml/xmlerror.h
+++ b/include/libxml/xmlerror.h
@@ -110,7 +110,7 @@
     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 ed39e36..ccbf53f 100644
--- a/include/libxml/xpathInternals.h
+++ b/include/libxml/xpathInternals.h
@@ -177,7 +177,7 @@
  *
  * 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 870cafb..08d18ee 100644
--- a/parser.c
+++ b/parser.c
@@ -6848,7 +6848,7 @@
      */
     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 b4dd280..1aecfb7 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)
 <doc><a/><b> but this</b><c>was not declared</c><b>seems</b></doc>
                                                                  ^
diff --git a/result/VC/ElementValid6 b/result/VC/ElementValid6
index 67967b2..bf63d47 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)
 <doc><a/><b>lacks c</b></doc>
                             ^
diff --git a/result/VC/ElementValid7 b/result/VC/ElementValid7
index a5727c2..de60754 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)
 <doc><a/><b/><a/><c/><c/><a/></doc>
                                   ^
diff --git a/valid.c b/valid.c
index 0ee4c33..24ce16a 100644
--- a/valid.c
+++ b/valid.c
@@ -97,11 +97,11 @@
 #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->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 @@
 			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 @@
 		    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 @@
 			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 @@
 			break;
 		    }
 		    DEBUG_VALID_MSG("Mult branch succeeded, continuing");
-		    /* SET_OCCURENCE; */
+		    /* SET_OCCURRENCE; */
 		    goto cont;
 	    }
 	}
@@ -3690,7 +3690,7 @@
 	/*
 	 * Then act accordingly at the parent level
 	 */
-	RESET_OCCURENCE;
+	RESET_OCCURRENCE;
 	if (CONT->parent == NULL)
 	    break;