fixing compilation and link option when configuring with --without-valid

* debugXML.c relaxng.c valid.c xinclude.c xmllint.c xmlreader.c:
  fixing compilation and link option when configuring with
  --without-valid should fix #135309
Daniel
diff --git a/ChangeLog b/ChangeLog
index 9350361..d602adc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Feb 25 12:50:53 CET 2004 Daniel Veillard <daniel@veillard.com>
+
+	* debugXML.c relaxng.c valid.c xinclude.c xmllint.c xmlreader.c:
+	  fixing compilation and link option when configuring with
+	  --without-valid should fix #135309
+
 Wed Feb 25 11:36:06 CET 2004 Daniel Veillard <daniel@veillard.com>
 
 	* catalog.c: fixed the main issues reported by Peter Breitenlohner
diff --git a/debugXML.c b/debugXML.c
index bcb1fcd..25c1d15 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -1955,6 +1955,7 @@
 }
 #endif /* LIBXML_OUTPUT_ENABLED */
 
+#ifdef LIBXML_VALID_ENABLED
 /**
  * xmlShellValidate:
  * @ctxt:  the shell context
@@ -1994,6 +1995,7 @@
     }
     return (res);
 }
+#endif /* LIBXML_VALID_ENABLED */
 
 /**
  * xmlShellDu:
@@ -2249,13 +2251,17 @@
 		  fprintf(ctxt->output, "\tsave [name]  save this document to name or the original name\n");
 		  fprintf(ctxt->output, "\twrite [name] write the current node to the filename\n");
 #endif /* LIBXML_OUTPUT_ENABLED */
+#ifdef LIBXML_VALID_ENABLED
 		  fprintf(ctxt->output, "\tvalidate     check the document for errors\n");
+#endif /* LIBXML_VALID_ENABLED */
 #ifdef LIBXML_SCHEMAS_ENABLED
 		  fprintf(ctxt->output, "\trelaxng rng  validate the document agaisnt the Relax-NG schemas\n");
 #endif
 		  fprintf(ctxt->output, "\tgrep string  search for a string in the subtree\n");
+#ifdef LIBXML_VALID_ENABLED
         } else if (!strcmp(command, "validate")) {
             xmlShellValidate(ctxt, arg, NULL, NULL);
+#endif /* LIBXML_VALID_ENABLED */
         } else if (!strcmp(command, "load")) {
             xmlShellLoad(ctxt, arg, NULL, NULL);
 #ifdef LIBXML_SCHEMAS_ENABLED
diff --git a/python/libxml2class.txt b/python/libxml2class.txt
index ae0e658..1df6037 100644
--- a/python/libxml2class.txt
+++ b/python/libxml2class.txt
@@ -632,6 +632,57 @@
 
     # functions from module xpointer
     xpointerNewContext()
+Class xpathContext()
+    # accessors
+    contextDoc()
+    contextNode()
+    contextPosition()
+    contextSize()
+    function()
+    functionURI()
+    setContextDoc()
+    setContextNode()
+
+    # functions from module python
+    registerXPathFunction()
+
+    # functions from module xpath
+    xpathEval()
+    xpathEvalExpression()
+    xpathFreeContext()
+
+    # functions from module xpathInternals
+    xpathNewParserContext()
+    xpathNsLookup()
+    xpathRegisterAllFunctions()
+    xpathRegisterNs()
+    xpathRegisteredFuncsCleanup()
+    xpathRegisteredNsCleanup()
+    xpathRegisteredVariablesCleanup()
+    xpathVariableLookup()
+    xpathVariableLookupNS()
+
+    # functions from module xpointer
+    xpointerEval()
+
+
+Class xmlAttribute(xmlNode)
+Class catalog()
+
+    # functions from module catalog
+    add()
+    catalogIsEmpty()
+    convertSGMLCatalog()
+    dump()
+    freeCatalog()
+    remove()
+    resolve()
+    resolvePublic()
+    resolveSystem()
+    resolveURI()
+
+
+Class xmlElement(xmlNode)
 
 
 Class xmlAttr(xmlNode)
@@ -650,6 +701,62 @@
     # functions from module valid
     removeID()
     removeRef()
+
+
+Class xmlTextReader(xmlTextReaderCore)
+
+    # functions from module xmlreader
+    AttributeCount()
+    BaseUri()
+    Close()
+    CurrentDoc()
+    CurrentNode()
+    Depth()
+    Expand()
+    GetAttribute()
+    GetAttributeNo()
+    GetAttributeNs()
+    GetParserProp()
+    GetRemainder()
+    HasAttributes()
+    HasValue()
+    IsDefault()
+    IsEmptyElement()
+    IsValid()
+    LocalName()
+    LookupNamespace()
+    MoveToAttribute()
+    MoveToAttributeNo()
+    MoveToAttributeNs()
+    MoveToElement()
+    MoveToFirstAttribute()
+    MoveToNextAttribute()
+    Name()
+    NamespaceUri()
+    NewDoc()
+    NewFd()
+    NewFile()
+    NewMemory()
+    NewWalker()
+    Next()
+    NextSibling()
+    NodeType()
+    Normalization()
+    Prefix()
+    Preserve()
+    QuoteChar()
+    Read()
+    ReadAttributeValue()
+    ReadInnerXml()
+    ReadOuterXml()
+    ReadState()
+    ReadString()
+    RelaxNGSetSchema()
+    RelaxNGValidate()
+    SetParserProp()
+    String()
+    Value()
+    XmlLang()
 Class xmlReg()
 
     # functions from module xmlregexp
@@ -657,6 +764,34 @@
     regexpFreeRegexp()
     regexpIsDeterminist()
     regexpPrint()
+
+
+Class xmlEntity(xmlNode)
+
+    # functions from module parserInternals
+    handleEntity()
+Class relaxNgSchema()
+
+    # functions from module relaxng
+    relaxNGDump()
+    relaxNGDumpTree()
+    relaxNGFree()
+    relaxNGNewValidCtxt()
+
+    # functions from module xmlreader
+    RelaxNGSetSchema()
+Class Error()
+    # accessors
+    code()
+    domain()
+    file()
+    level()
+    line()
+    message()
+
+    # functions from module xmlerror
+    copyError()
+    resetError()
 Class relaxNgValidCtxt()
 
     # functions from module relaxng
@@ -665,6 +800,73 @@
     relaxNGValidatePopElement()
     relaxNGValidatePushCData()
     relaxNGValidatePushElement()
+Class xpathParserContext()
+    # accessors
+    context()
+
+    # functions from module xpathInternals
+    xpathAddValues()
+    xpathBooleanFunction()
+    xpathCeilingFunction()
+    xpathCompareValues()
+    xpathConcatFunction()
+    xpathContainsFunction()
+    xpathCountFunction()
+    xpathDivValues()
+    xpathEqualValues()
+    xpathErr()
+    xpathEvalExpr()
+    xpathFalseFunction()
+    xpathFloorFunction()
+    xpathFreeParserContext()
+    xpathIdFunction()
+    xpathLangFunction()
+    xpathLastFunction()
+    xpathLocalNameFunction()
+    xpathModValues()
+    xpathMultValues()
+    xpathNamespaceURIFunction()
+    xpathNextAncestor()
+    xpathNextAncestorOrSelf()
+    xpathNextAttribute()
+    xpathNextChild()
+    xpathNextDescendant()
+    xpathNextDescendantOrSelf()
+    xpathNextFollowing()
+    xpathNextFollowingSibling()
+    xpathNextNamespace()
+    xpathNextParent()
+    xpathNextPreceding()
+    xpathNextPrecedingSibling()
+    xpathNextSelf()
+    xpathNormalizeFunction()
+    xpathNotEqualValues()
+    xpathNotFunction()
+    xpathNumberFunction()
+    xpathParseNCName()
+    xpathParseName()
+    xpathPopBoolean()
+    xpathPopNumber()
+    xpathPopString()
+    xpathPositionFunction()
+    xpathRoot()
+    xpathRoundFunction()
+    xpathStartsWithFunction()
+    xpathStringFunction()
+    xpathStringLengthFunction()
+    xpathSubValues()
+    xpathSubstringAfterFunction()
+    xpathSubstringBeforeFunction()
+    xpathSubstringFunction()
+    xpathSumFunction()
+    xpathTranslateFunction()
+    xpathTrueFunction()
+    xpathValueFlipSign()
+    xpatherror()
+
+    # functions from module xpointer
+    xpointerEvalRangePredicate()
+    xpointerRangeToFunction()
 
 
 Class parserCtxt(parserCtxtCore)
@@ -772,92 +974,6 @@
     dtdElementDesc()
     dtdQAttrDesc()
     dtdQElementDesc()
-Class relaxNgParserCtxt()
-
-    # functions from module relaxng
-    relaxNGFreeParserCtxt()
-    relaxNGParse()
-    relaxParserSetFlag()
-Class xpathParserContext()
-    # accessors
-    context()
-
-    # functions from module xpathInternals
-    xpathAddValues()
-    xpathBooleanFunction()
-    xpathCeilingFunction()
-    xpathCompareValues()
-    xpathConcatFunction()
-    xpathContainsFunction()
-    xpathCountFunction()
-    xpathDivValues()
-    xpathEqualValues()
-    xpathErr()
-    xpathEvalExpr()
-    xpathFalseFunction()
-    xpathFloorFunction()
-    xpathFreeParserContext()
-    xpathIdFunction()
-    xpathLangFunction()
-    xpathLastFunction()
-    xpathLocalNameFunction()
-    xpathModValues()
-    xpathMultValues()
-    xpathNamespaceURIFunction()
-    xpathNextAncestor()
-    xpathNextAncestorOrSelf()
-    xpathNextAttribute()
-    xpathNextChild()
-    xpathNextDescendant()
-    xpathNextDescendantOrSelf()
-    xpathNextFollowing()
-    xpathNextFollowingSibling()
-    xpathNextNamespace()
-    xpathNextParent()
-    xpathNextPreceding()
-    xpathNextPrecedingSibling()
-    xpathNextSelf()
-    xpathNormalizeFunction()
-    xpathNotEqualValues()
-    xpathNotFunction()
-    xpathNumberFunction()
-    xpathParseNCName()
-    xpathParseName()
-    xpathPopBoolean()
-    xpathPopNumber()
-    xpathPopString()
-    xpathPositionFunction()
-    xpathRoot()
-    xpathRoundFunction()
-    xpathStartsWithFunction()
-    xpathStringFunction()
-    xpathStringLengthFunction()
-    xpathSubValues()
-    xpathSubstringAfterFunction()
-    xpathSubstringBeforeFunction()
-    xpathSubstringFunction()
-    xpathSumFunction()
-    xpathTranslateFunction()
-    xpathTrueFunction()
-    xpathValueFlipSign()
-    xpatherror()
-
-    # functions from module xpointer
-    xpointerEvalRangePredicate()
-    xpointerRangeToFunction()
-Class catalog()
-
-    # functions from module catalog
-    add()
-    catalogIsEmpty()
-    convertSGMLCatalog()
-    dump()
-    freeCatalog()
-    remove()
-    resolve()
-    resolvePublic()
-    resolveSystem()
-    resolveURI()
 
 
 Class xmlNs(xmlNode)
@@ -881,6 +997,42 @@
 
     # functions from module xpathInternals
     xpathNodeSetFreeNs()
+
+
+Class inputBuffer(ioReadWrapper)
+
+    # functions from module xmlIO
+    freeParserInputBuffer()
+    grow()
+    push()
+    read()
+
+    # functions from module xmlreader
+    newTextReader()
+Class relaxNgParserCtxt()
+
+    # functions from module relaxng
+    relaxNGFreeParserCtxt()
+    relaxNGParse()
+    relaxParserSetFlag()
+
+
+Class outputBuffer(ioWriteWrapper)
+
+    # functions from module HTMLtree
+    htmlDocContentDumpFormatOutput()
+    htmlDocContentDumpOutput()
+    htmlNodeDumpFormatOutput()
+    htmlNodeDumpOutput()
+
+    # functions from module tree
+    nodeDumpOutput()
+    saveFileTo()
+    saveFormatFileTo()
+
+    # functions from module xmlIO
+    write()
+    writeString()
 Class xmlTextReaderLocator()
 
     # functions from module xmlreader
@@ -912,155 +1064,3 @@
     parseURIReference()
     printURI()
     saveUri()
-
-
-Class xmlAttribute(xmlNode)
-Class xpathContext()
-    # accessors
-    contextDoc()
-    contextNode()
-    contextPosition()
-    contextSize()
-    function()
-    functionURI()
-    setContextDoc()
-    setContextNode()
-
-    # functions from module python
-    registerXPathFunction()
-
-    # functions from module xpath
-    xpathEval()
-    xpathEvalExpression()
-    xpathFreeContext()
-
-    # functions from module xpathInternals
-    xpathNewParserContext()
-    xpathNsLookup()
-    xpathRegisterAllFunctions()
-    xpathRegisterNs()
-    xpathRegisteredFuncsCleanup()
-    xpathRegisteredNsCleanup()
-    xpathRegisteredVariablesCleanup()
-    xpathVariableLookup()
-    xpathVariableLookupNS()
-
-    # functions from module xpointer
-    xpointerEval()
-
-
-Class xmlElement(xmlNode)
-
-
-Class xmlTextReader(xmlTextReaderCore)
-
-    # functions from module xmlreader
-    AttributeCount()
-    BaseUri()
-    Close()
-    CurrentDoc()
-    CurrentNode()
-    Depth()
-    Expand()
-    GetAttribute()
-    GetAttributeNo()
-    GetAttributeNs()
-    GetParserProp()
-    GetRemainder()
-    HasAttributes()
-    HasValue()
-    IsDefault()
-    IsEmptyElement()
-    IsValid()
-    LocalName()
-    LookupNamespace()
-    MoveToAttribute()
-    MoveToAttributeNo()
-    MoveToAttributeNs()
-    MoveToElement()
-    MoveToFirstAttribute()
-    MoveToNextAttribute()
-    Name()
-    NamespaceUri()
-    NewDoc()
-    NewFd()
-    NewFile()
-    NewMemory()
-    NewWalker()
-    Next()
-    NextSibling()
-    NodeType()
-    Normalization()
-    Prefix()
-    Preserve()
-    QuoteChar()
-    Read()
-    ReadAttributeValue()
-    ReadInnerXml()
-    ReadOuterXml()
-    ReadState()
-    ReadString()
-    RelaxNGSetSchema()
-    RelaxNGValidate()
-    SetParserProp()
-    String()
-    Value()
-    XmlLang()
-
-
-Class xmlEntity(xmlNode)
-
-    # functions from module parserInternals
-    handleEntity()
-Class Error()
-    # accessors
-    code()
-    domain()
-    file()
-    level()
-    line()
-    message()
-
-    # functions from module xmlerror
-    copyError()
-    resetError()
-Class relaxNgSchema()
-
-    # functions from module relaxng
-    relaxNGDump()
-    relaxNGDumpTree()
-    relaxNGFree()
-    relaxNGNewValidCtxt()
-
-    # functions from module xmlreader
-    RelaxNGSetSchema()
-
-
-Class inputBuffer(ioReadWrapper)
-
-    # functions from module xmlIO
-    freeParserInputBuffer()
-    grow()
-    push()
-    read()
-
-    # functions from module xmlreader
-    newTextReader()
-
-
-Class outputBuffer(ioWriteWrapper)
-
-    # functions from module HTMLtree
-    htmlDocContentDumpFormatOutput()
-    htmlDocContentDumpOutput()
-    htmlNodeDumpFormatOutput()
-    htmlNodeDumpOutput()
-
-    # functions from module tree
-    nodeDumpOutput()
-    saveFileTo()
-    saveFormatFileTo()
-
-    # functions from module xmlIO
-    write()
-    writeString()
diff --git a/relaxng.c b/relaxng.c
index 4370ef3..d884bee 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -10464,6 +10464,7 @@
         xmlRelaxNGDumpValidError(ctxt);
     }
 #endif
+#ifdef LIBXML_VALID_ENABLED
     if (ctxt->idref == 1) {
         xmlValidCtxt vctxt;
 
@@ -10476,6 +10477,7 @@
         if (xmlValidateDocumentFinal(&vctxt, doc) != 1)
             ret = -1;
     }
+#endif /* LIBXML_VALID_ENABLED */
     if ((ret == 0) && (ctxt->errNo != XML_RELAXNG_OK))
         ret = -1;
 
diff --git a/valid.c b/valid.c
index 22e41e6..d2774e7 100644
--- a/valid.c
+++ b/valid.c
@@ -105,6 +105,42 @@
                         msg);
 }
 
+#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
+/**
+ * xmlErrValidNode:
+ * @ctxt:  an XML validation parser context
+ * @node:  the node raising the error
+ * @error:  the error number
+ * @str1:  extra informations
+ * @str2:  extra informations
+ * @str3:  extra informations
+ *
+ * Handle a validation error, provide contextual informations
+ */
+static void
+xmlErrValidNode(xmlValidCtxtPtr ctxt,
+                xmlNodePtr node, xmlParserErrors error,
+                const char *msg, const xmlChar * str1,
+                const xmlChar * str2, const xmlChar * str3)
+{
+    xmlStructuredErrorFunc schannel = NULL;
+    xmlGenericErrorFunc channel = NULL;
+    xmlParserCtxtPtr pctxt = NULL;
+    void *data = NULL;
+
+    if (ctxt != NULL) {
+        channel = ctxt->error;
+        data = ctxt->userData;
+	pctxt = ctxt->userData;
+    }
+    __xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
+                    XML_ERR_ERROR, NULL, 0,
+                    (const char *) str1,
+                    (const char *) str1,
+                    (const char *) str3, 0, 0, msg, str1, str2, str3);
+}
+#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
+
 #ifdef LIBXML_VALID_ENABLED
 /**
  * xmlErrValidNodeNr:
@@ -139,39 +175,7 @@
                     (const char *) str3,
                     NULL, int2, 0, msg, str1, int2, str3);
 }
-/**
- * xmlErrValidNode:
- * @ctxt:  an XML validation parser context
- * @node:  the node raising the error
- * @error:  the error number
- * @str1:  extra informations
- * @str2:  extra informations
- * @str3:  extra informations
- *
- * Handle a validation error, provide contextual informations
- */
-static void
-xmlErrValidNode(xmlValidCtxtPtr ctxt,
-                xmlNodePtr node, xmlParserErrors error,
-                const char *msg, const xmlChar * str1,
-                const xmlChar * str2, const xmlChar * str3)
-{
-    xmlStructuredErrorFunc schannel = NULL;
-    xmlGenericErrorFunc channel = NULL;
-    xmlParserCtxtPtr pctxt = NULL;
-    void *data = NULL;
 
-    if (ctxt != NULL) {
-        channel = ctxt->error;
-        data = ctxt->userData;
-	pctxt = ctxt->userData;
-    }
-    __xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error,
-                    XML_ERR_ERROR, NULL, 0,
-                    (const char *) str1,
-                    (const char *) str1,
-                    (const char *) str3, 0, 0, msg, str1, str2, str3);
-}
 /**
  * xmlErrValidWarning:
  * @ctxt:  an XML validation parser context
@@ -2722,7 +2726,8 @@
  * Do nothing, return 0. Used to create unordered lists.
  */
 static int
-xmlDummyCompare(const void *data0, const void *data1)
+xmlDummyCompare(const void *data0 ATTRIBUTE_UNUSED,
+                const void *data1 ATTRIBUTE_UNUSED)
 {
     return (0);
 }
@@ -3150,7 +3155,7 @@
     return(xmlHashLookup(table, name));
 }
 
-#ifdef LIBXML_VALID_ENABLED
+#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
 /**
  * xmlValidateNotationUse:
  * @ctxt:  the validation context
@@ -3181,7 +3186,7 @@
     }
     return(1);
 }
-#endif /* LIBXML_VALID_ENABLED */
+#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
 
 /**
  * xmlIsMixedElement:
diff --git a/xinclude.c b/xinclude.c
index 4cd762f..9247632 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -132,6 +132,7 @@
 		    msg, (const char *) extra);
 }
 
+#if 0
 /**
  * xmlXIncludeWarn:
  * @ctxt: the XInclude context
@@ -150,6 +151,7 @@
 		    (const char *) extra, NULL, NULL, 0, 0,
 		    msg, (const char *) extra);
 }
+#endif
 
 /**
  * xmlXIncludeGetProp:
diff --git a/xmllint.c b/xmllint.c
index 5d1c03b..5488dfd 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -704,20 +704,16 @@
 	}
 	if ((timing) && (!repeat)) {
 #ifdef LIBXML_SCHEMAS_ENABLED
-	    if ((valid) || (relaxng != NULL))
+	    if (relaxng != NULL)
 		endTimer("Parsing and validating");
 	    else
-		endTimer("Parsing");
-#else
+#endif
 #ifdef LIBXML_VALID_ENABLED
 	    if (valid)
 		endTimer("Parsing and validating");
 	    else
-		endTimer("Parsing");
-#else
-	    endTimer("Parsing");
-#endif /* LIBXML_VALID_ENABLED */
 #endif
+	    endTimer("Parsing");
 	}
 
 #ifdef LIBXML_VALID_ENABLED
diff --git a/xmlreader.c b/xmlreader.c
index e78b286..8a533a2 100644
--- a/xmlreader.c
+++ b/xmlreader.c
@@ -877,6 +877,7 @@
 xmlTextReaderValidatePush(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) {
     xmlNodePtr node = reader->node;
 
+#ifdef LIBXML_VALID_ENABLED
     if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
         (reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
 	if ((node->ns == NULL) || (node->ns->prefix == NULL)) {
@@ -894,8 +895,10 @@
 	    if (qname != NULL)
 		xmlFree(qname);
 	}
+    }
+#endif /* LIBXML_VALID_ENABLED */
 #ifdef LIBXML_SCHEMAS_ENABLED
-    } else if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
+    if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
                (reader->rngValidCtxt != NULL)) {
 	int ret;
 
@@ -920,8 +923,8 @@
 	}
 	if (ret != 1)
 	    reader->rngValidErrors++;
-#endif
     }
+#endif
 }
 
 /**
@@ -935,12 +938,15 @@
 static void
 xmlTextReaderValidateCData(xmlTextReaderPtr reader,
                            const xmlChar *data, int len) {
+#ifdef LIBXML_VALID_ENABLED
     if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
         (reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
 	reader->ctxt->valid &= xmlValidatePushCData(&reader->ctxt->vctxt,
 	                                            data, len);
+    }
+#endif /* LIBXML_VALID_ENABLED */
 #ifdef LIBXML_SCHEMAS_ENABLED
-    } else if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
+    if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
                (reader->rngValidCtxt != NULL)) {
 	int ret;
 
@@ -948,8 +954,8 @@
 	ret = xmlRelaxNGValidatePushCData(reader->rngValidCtxt, data, len);
 	if (ret != 1)
 	    reader->rngValidErrors++;
-#endif
     }
+#endif
 }
 
 /**
@@ -962,6 +968,7 @@
 xmlTextReaderValidatePop(xmlTextReaderPtr reader) {
     xmlNodePtr node = reader->node;
 
+#ifdef LIBXML_VALID_ENABLED
     if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
         (reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
 	if ((node->ns == NULL) || (node->ns->prefix == NULL)) {
@@ -979,8 +986,10 @@
 	    if (qname != NULL)
 		xmlFree(qname);
 	}
+    }
+#endif /* LIBXML_VALID_ENABLED */
 #ifdef LIBXML_SCHEMAS_ENABLED
-    } else if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
+    if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
                (reader->rngValidCtxt != NULL)) {
 	int ret;
 
@@ -994,8 +1003,8 @@
 					   node);
 	if (ret != 1)
 	    reader->rngValidErrors++;
-#endif
     }
+#endif
 }
 
 /**